I need to get access to each child after I dynamically add them to the scene, but I have problems figuring out how.
In a click, it adds an image to the scene, and I need to make them glow one at a time using the for () function, but I cannot figure out how to name them each with its own name (name + i) to access them later.
Thank you in advance
stage.addEventListener(MouseEvent.MOUSE_DOWN, clicky);
var i = 1;
function clicky(event:MouseEvent):void
{
i++;
var fl_MyInstance:LibrarySymbol = new LibrarySymbol();
addChild(fl_MyInstance);
var myStageX:Number = Math.round(event.stageX);
var myStageY:Number = Math.round(event.stageY);
fl_MyInstance.x = myStageX;
fl_MyInstance.y = myStageY;
if(myStageX<150){
fl_MyInstance.scaleX = fl_MyInstance.scaleY = 1-(myStageX/300);
}else{
fl_MyInstance.scaleX = fl_MyInstance.scaleY = 0.5;
}
}
EDIT: Thanks for the answer. I will try to do this with an array, given that I want to make them removable later. The goal of the project is to create stars on the stage where you click and move the point from one star to another so that they glow when they hit them.