# CS3AS3 array based button links help

**URL:** <https://forum.kirupa.com/t/cs3as3-array-based-button-links-help/275416>\
**Category:** flash\
**Created:** [November 13, 2008, 5:12pm UTC](https://forum.kirupa.com/t/cs3as3-array-based-button-links-help/275416 "2008-11-13T17:12:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cbbdesign](https://avatars.discourse-cdn.com/v4/letter/c/6bbea6/32.png) [@cbbdesign](https://forum.kirupa.com/u/cbbdesign)\
**Post date:** [November 13, 2008, 5:12pm UTC](https://forum.kirupa.com/t/cs3as3-array-based-button-links-help/275416/1 "2008-11-13T17:12:35Z")

</div>

\*\*[FONT=Arial]import flash.events.MouseEvent;

//-- I’ve got a flash scene that has tons of buttons on it.  
//-- each button has its own instance name on the stage.  
//-- instead of repeating all this code for each button over and over…  
//-- is there a way that I can use an array for both the button names and unique url link?

//-- on stage button name “citya”  
citya.addEventListener(MouseEvent.CLICK, gotocitya);  
function gotocitya(event:MouseEvent):void  
{  
// – this button name “citya” has a unique url link  
var myURL:URLRequest = new URLRequest(“index.php?main\_page=index&cPath=74”);  
navigateToURL(myURL);  
}

//-- on stage button name “cityb”  
cityb.addEventListener(MouseEvent.CLICK, gotocityb);  
function gotocityb(event:MouseEvent):void  
{  
// – button name “cityb” has a unique url link  
var myURL:URLRequest = new URLRequest(“index.php?main\_page=index&cPath=75”);  
navigateToURL(myURL);  
}

//-- on stage button name “cityc”  
cityc.addEventListener(MouseEvent.CLICK, gotocityc);  
function gotocityc(event:MouseEvent):void  
{  
// – button name “cityc” has a unique url link  
var myURL:URLRequest = new URLRequest(“index.php?main\_page=index&cPath=76”);  
navigateToURL(myURL);  
}

// – on and on and on…

stop();[/FONT]\*\*
