# How to target dynamically created objects

**URL:** <https://forum.kirupa.com/t/how-to-target-dynamically-created-objects/295731>\
**Category:** flash\
**Created:** [September 3, 2009, 4:05pm UTC](https://forum.kirupa.com/t/how-to-target-dynamically-created-objects/295731 "2009-09-03T16:05:54Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CayoHueso](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@CayoHueso](https://forum.kirupa.com/u/CayoHueso)\
**Post date:** [September 3, 2009, 4:05pm UTC](https://forum.kirupa.com/t/how-to-target-dynamically-created-objects/295731/1 "2009-09-03T16:05:54Z")

</div>

[SIZE=1]Hi, I am learning AS3, and I am trying to understand how to target dynamically created objects. I have the code:

```auto

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]

```auto

[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]
