简体   繁体   中英

I can't move Movieclip by .x properity

I have a little bug and I can't figure out ho to repair it. in my array 'youreq' i have objects with structure {ID:Object, name:String, Q:int}. My code is:

for each (var num in youreq)
{
trace(num.ID); //Object 1a8e191
trace("x"+num.ID.x); //x355.15
trace("y"+num.ID.y); //y108.45
trace(tns); //36
num.ID.x -=  tns;
num.ID.visible = false; //nothing changed...
trace(num.ID.x); //319.15
}

but nothings happens (I want to move MovieClip 6 pixels in left, but also toggling visibility doesn't work). Could anybody help me? :)

Try to cast num.ID to MovieClip. And make sure that num.ID is MovieClip.

for each (var num in youreq)
{
trace(num.ID); //Object 1a8e191
trace("x"+num.ID.x); //x355.15
trace("y"+num.ID.y); //y108.45
trace(tns); //36
trace (num.ID is MovieClip) // check if the ID object is MovieClip
MovieClip(num.ID).x -=  tns;
MovieClip(num.ID).visible = false; //nothing changed...

trace(num.ID.x); //319.15
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM