Hello and good day to you!
I am attempting to push an object into an array based on its instance name on the stage…how do I do this?
On my stage I’ve simply made a box, turned it into a movie clip named “mcBox” and have given it an instance name of “box_mc” on the stage. Here is my current test code:
var energy:Number = 0.75;
var boxArray:Array = new Array;
box_mc.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void
{
if(energy >= 0.5)
{
boxArray.push(box_mc);
}
trace(boxArray);
}
Since the default amount of energy satisfies the if statement I push the movieClip into the array and then trace it. In my output I receive “[object MovieClip]”…is there anyway to distinguish it by its instance name?
What am I doing wrong?