# Assembled Variable Problem: How do I get the contents out?

**URL:** https://forum.kirupa.com/t/assembled-variable-problem-how-do-i-get-the-contents-out/186083
**Category:** flash
**Created:** [April 18, 2006, 10:41pm UTC](https://forum.kirupa.com/t/assembled-variable-problem-how-do-i-get-the-contents-out/186083 "2006-04-18T22:41:19Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jugglerpm](https://avatars.discourse-cdn.com/v4/letter/j/87869e/32.png) [@jugglerpm](https://forum.kirupa.com/u/jugglerpm)
#### Post date: [April 18, 2006, 10:41pm UTC](https://forum.kirupa.com/t/assembled-variable-problem-how-do-i-get-the-contents-out/186083/1 "2006-04-18T22:41:19Z")

</div>

I’m having trouble getting an ‘assembled’ variable to return the variable contents.

On movieclip release I would like to put the content of a pre-defined variable into a getURL, but I can only get it to return the name of the URL and not the contents.

Thanks for any help.

See below.

> 

//Variables defined  
var button1URL:String = “/home”;  
var button2URL:String = “/welcome”;  
var button3URL:String = “/quiz”;  
// this trace works, it returns the string I want. ex: “/home”  
trace(button1URL);

// Build Nav Button Actions // (this is much simplified)  
for (var i = 1; i\<=3; i++) {  
tempButtonName = “button”+i+“\_mc”;  
buttons\_mc[tempButtonName].hitArea\_mc.onRelease = function() {  
var buttonURL = this.\_parent.\_name.slice(0, 7)+“URL”;  
// Here I build the variable over again based on which button is clicked  
trace(buttonURL);  
// \*\*\*\* this returns the right variable, but I can’t remember how to make it return the VALUE of the variable.  
// EX: it returns button1URL not “/home”  
getURL(buttonURL);  
};  
}

---

<div class="post-metadata">

### Author: ![TheCanadian](https://avatars.discourse-cdn.com/v4/letter/t/67e7ee/32.png) [@TheCanadian](https://forum.kirupa.com/u/TheCanadian)
#### Post date: [April 18, 2006, 11:43pm UTC](https://forum.kirupa.com/t/assembled-variable-problem-how-do-i-get-the-contents-out/186083/2 "2006-04-18T23:43:30Z")

</div>

```auto
var button1URL:String = "/home";
var button2URL:String = "/welcome";
var button3URL:String = "/quiz";
for (var i = 1; i <= 3; i++) {
 tempButtonName = "button" + i + "_mc";
 buttons_mc[tempButtonName].hitArea_mc.onRelease = function() {
  var buttonURL = this._parent._parent._parent[this._parent._name.slice(0, 7) + "URL"];
  getURL(buttonURL);
 };
}

```

---

<div class="post-metadata">

### Author: ![jugglerpm](https://avatars.discourse-cdn.com/v4/letter/j/87869e/32.png) [@jugglerpm](https://forum.kirupa.com/u/jugglerpm)
#### Post date: [April 19, 2006, 12:17am UTC](https://forum.kirupa.com/t/assembled-variable-problem-how-do-i-get-the-contents-out/186083/3 "2006-04-19T00:17:30Z")

</div>

Oh my, I never would have figured that out. I’m glad I asked. Thanks so much! –  
PM
