错误#1010(可能是对象错误)

时间:2011-12-09 00:33:57

标签: actionscript-3

当我测试我的电影时,我收到此错误: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;

1 个答案:

答案 0 :(得分:3)

您需要先定义pieces.a2pieces.mc,然后才能定义a2mc的属性。

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;

为清楚起见,您的错误指的是a2mc未定义且没有属性。