# Dynamic .onRelease / GetUrl Technique

**URL:** <https://forum.kirupa.com/t/dynamic-onrelease-geturl-technique/171185>\
**Category:** flash\
**Created:** [December 2, 2005, 3:38pm UTC](https://forum.kirupa.com/t/dynamic-onrelease-geturl-technique/171185 "2005-12-02T15:38:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![brentnicholas](https://avatars.discourse-cdn.com/v4/letter/b/9de053/32.png) [@brentnicholas](https://forum.kirupa.com/u/brentnicholas)\
**Post date:** [December 2, 2005, 3:38pm UTC](https://forum.kirupa.com/t/dynamic-onrelease-geturl-technique/171185/1 "2005-12-02T15:38:49Z")

</div>

Hello all -

I’m kind of new to Flash, I took the ActionScript for programmers class from Macromedia so I’m not a total noob ;))

Nonetheless I’m a bit stuck. I’m not sure if I can do the following. If this will take a lot of time to explaine maybe someone could point me at some key words, or key concepts.

**Background:**  
[font=Tahoma]Instead of having to write a “.onRelease / getURL” for every button on the map, I tried to put the instance names of all the symbol/buttons in an array and loop over that array to create the “.onRelease / getURL” dynamicly.[/font]  
[font=Tahoma][/font]  
[font=Tahoma] **Code:** [/font]  
[font=Tahoma][font=Arial][size=2]// this is the array of symbol/button instance names that have been created in the movie[/size][/font]  
[font=Arial][size=2][color=#0000ff]var StateArray = new Array(“Vorarlberg\_btn”,“Tirol\_btn”,“Salzburg\_btn”,“Tirol2\_btn”,“Oberosterrich\_btn”,“Karnten\_btn”,“Steiermark\_btn”,“Niederosterreich\_btn”,“Wien\_btn”,“Burgenland\_btn”);[/color][/size][/font]  
[font=Arial][size=2][color=#0000ff]  
[/color][/size][/font][font=Arial][size=2][color=#0000ff][color=#000000]// this is the section I am unsure of, can this be done??[/color]  
[/color][/size][/font][font=Arial][size=2][color=#0000ff]/\*  
for (var i=1; i \<= StateArray.length; i++)  
{  
StateArray\*.onRelease = function() {  
getURL(“javascript:ListInfo(‘Austria’,”+"’"+StateArray\*+"’)");  
};  
}  
\*/[/color][/size][/font]  
[font=Arial][size=2][color=#0000ff][/color][/size][/font]  
//Original code to prove concept of sending data to bowser via js or URL load.  
[font=Arial][size=2][color=#0000ff][font=Tahoma][size=2][color=#000000]// used to make URL string easy to use[/color][/size][/font]  
[font=Arial][size=2]var baseURL = “[[color=#0000ff]http://localhost/RincEx/Mapping/MapTest/index.cfm?FUSEACTION=ShowResult[/color]](http://localhost/RincEx/Mapping/MapTest/index.cfm?FUSEACTION=ShowResult)”;[/size][/font]  
[font=Arial][size=2][/size][/font]  
[font=Arial][size=2]var baseCountry = “Austria”;[/size][/font]  
[/color][/size][/font]  
[font=Arial][size=2][color=#0000ff][/color][/size][/font]  
[font=Arial][size=2]// if I hard code the instance name of the symbol/buttons, it works fine. (Also, I comment these out to test the block above.)[/size][/font]  
[font=Arial][size=2][color=#0000ff]Tirol2\_btn.onRelease = function() {  
getURL(“javascript:ListInfo(‘Austria’,”+"‘Tirol2’)");  
};[/color][/size][/font]  
[font=Arial][size=2][color=#0000ff][/color][/size][/font]  
[font=Arial][size=2]// this works fine also, again hard coded instance name (Also, I comment these out to test the block above.)[/size][/font]  
[font=Arial][size=2][color=#0000ff]Tirol\_btn.onRelease = function() {  
getURL(baseURL + “&COUNTRY=Austria&STATE=Tirol”, “RESULT\_FRAME”);  
};[/color][/size][/font]  
[/font]
