# How to access dynamically placed buttons

**URL:** <https://forum.kirupa.com/t/how-to-access-dynamically-placed-buttons/245041>\
**Category:** flash\
**Created:** [November 25, 2007, 7:00pm UTC](https://forum.kirupa.com/t/how-to-access-dynamically-placed-buttons/245041 "2007-11-25T19:00:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![danar](https://avatars.discourse-cdn.com/v4/letter/d/aeb1de/32.png) [@danar](https://forum.kirupa.com/u/danar)\
**Post date:** [November 25, 2007, 7:00pm UTC](https://forum.kirupa.com/t/how-to-access-dynamically-placed-buttons/245041/1 "2007-11-25T19:00:27Z")

</div>

I am having a lot of trouble figuring out how I am going to access these buttons outside of the function which created them. If someone wouldn’t mind showing me how that would be great.

Even if someone could simply write a separate function that would trace the text on any of the buttons that would show me what i need to know.

Thanks in advance.

[download fla](http://www.roberts-racing.com/test/test.fla)

//BUTTON IN LIBRARY HAS LINKAGE NAME btn

function setBtn():void{  
var myBtn:btn;  
for(var i:Number=0;i\<20;i++){  
myBtn=new btn();  
this.addChild(myBtn);  
myBtn.name=“btn”+String(i);  
myBtn.y=i_15+(i_2);  
myBtn.txt.text = “stop”+i;  
myBtn.index=i;  
myBtn.alpha=0.7  
trace(myBtn.txt.text);  
}  
}

setBtn();
