我无法通过.x繁荣移动Movieclip

时间:2012-12-06 00:45:56

标签: actionscript-3 flash movieclip

我有一个小虫子,我无法弄清楚要修复它。在我的数组'youreq'中我有结构{ID:Object,name:String,Q:int}的对象。我的代码是:

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
}

但是没有发生(我想在左边移动MovieClip 6像素,但切换可见性也不起作用)。有人能帮助我吗? :)

1 个答案:

答案 0 :(得分:2)

尝试将num.ID强制转换为MovieClip。并确保num.ID是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
}