当我测试我的电影时,我收到此错误:TypeError:错误#1010:术语未定义且没有属性。我认为它是由儿童对象引起的,但我无法解决它。我的代码:
var wPawn1:Object = new Object();
wPawn1.mc = new WhitePawn();
addChild(wPawn1.mc);
// Black inPeace variables
wPawn1.inPeace = "a2";
var pieces:Object = new Object();
pieces.a2.man = MovieClip(wPawn1.mc);
pieces.a2.x = 70;
pieces.a2.y = 491;
wPawn1.mc.x = pieces.a2.x;
wPawn1.mc.y = pieces.a2.y;
答案 0 :(得分:3)
您需要先定义pieces.a2
和pieces.mc
,然后才能定义a2
和mc
的属性。
var pieces:Object = new Object();
pieces.a2 = blah;
pieces.mc = blah;
pieces.a2.man = MovieClip(wPawn1.mc);
pieces.a2.x = 70;
pieces.a2.y = 491;
wPawn1.mc.x = pieces.a2.x;
wPawn1.mc.y = pieces.a2.y;
为清楚起见,您的错误指的是a2
和mc
未定义且没有属性。