[SIZE=1]Hi, I am learning AS3, and I am trying to understand how to target dynamically created objects. I have the code:
for (var i:Number = 0; i<5; i++) {
var boton:CreateButton(stage.stageWidth/5,30,0,1,colors*,test,0xFFFFFF,"English");
boton.name="button"+i;
addChild(boton);
boton.y=0;
boton.x=i*boton.width;
}
[/SIZE]
[SIZE=1]
and I created this to target the buttons. I don’t know if this is the way to do it:
[/SIZE]
[SIZE=1]var button0:* =getChildByName('button0');
var button1:* =getChildByName('button1');
var button2:* =getChildByName('button2');
var button3:* =getChildByName('button3');
var button4:* =getChildByName('button4');
[/SIZE]
[SIZE=1]
Could you please share some advice
[/SIZE]