user972043
user972043

Reputation: 11

Why do I receive [object MovieClip] when tracing movieclips from an array?

I want to put a set of onstage movieclip instances into an array, but I am getting object MovieClip instead of the instance name. Any ideas? Thanks.

var puz1_arr:Array = new Array (puz1.wMc, puz1.aMc);
trace(puz1_arr);

The trace gives me: [object MovieClip],[object MovieClip]

instead of: puz1.wMc,puz1.aMc

Upvotes: 0

Views: 51

Answers (1)

Anil
Anil

Reputation: 2554

Accessing the instance of a MovieClip, gives you the MovieClip as an object of type MovieClip.

If you want the name of the MovieClip object, simply use the .name property of the MovieClip Object.

Try this:

var puz1_arr:Array = new Array (puz1.wMc.name, puz1.aMc.name);
trace(puz1_arr);

This is assuming that puz1.wMc and puz1.aMc are MovieClip Objects.

Reference:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/DisplayObject.html#name

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/display/MovieClip.html#propertySummary

Upvotes: 1

Related Questions