nikel
nikel

Reputation: 653

Error #1010 (Probably an object error)

When I test my movie, I'm getting this error: TypeError: Error #1010: A term is undefined and has no properties. I think it's caused by child objects but I couldn't fix it. My code:

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;

Upvotes: 2

Views: 828

Answers (1)

Marty
Marty

Reputation: 39456

You need to define pieces.a2 and pieces.mc before you can define properties of a2 and 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;

For clarity, your error is referring to a2 and mc as being undefined and having no properties.

Upvotes: 3

Related Questions