# Can a variable be dynamic

**URL:** <https://forum.kirupa.com/t/can-a-variable-be-dynamic/29269>\
**Category:** flash\
**Created:** [August 25, 2003, 4:22am UTC](https://forum.kirupa.com/t/can-a-variable-be-dynamic/29269 "2003-08-25T04:22:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![waffe](https://avatars.discourse-cdn.com/v4/letter/w/c37758/32.png) [@waffe](https://forum.kirupa.com/u/waffe)\
**Post date:** [August 25, 2003, 4:22am UTC](https://forum.kirupa.com/t/can-a-variable-be-dynamic/29269/1 "2003-08-25T04:22:11Z")

</div>

I am using the var call in a button like this:

var menuPage = menuTxt

I then have other buttons that have a command like this:

1st button  
menuPage = “m1”

2nd button  
menuPage = “m2”

The result right now is if I select the button with menuPage = “m1” the var call still equals:

var menuPage = menuTxt

I would like it if it would equal

var m1 = menuTxt

Can this be done?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 4:32am UTC](https://forum.kirupa.com/t/can-a-variable-be-dynamic/29269/2 "2003-08-25T04:32:07Z")

</div>

May I take a look at your code? You’re surely creating two different variables. :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 6:38am UTC](https://forum.kirupa.com/t/can-a-variable-be-dynamic/29269/3 "2003-08-25T06:38:59Z")

</div>

Sure you can, here you go.🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 7:02am UTC](https://forum.kirupa.com/t/can-a-variable-be-dynamic/29269/4 "2003-08-25T07:02:43Z")

</div>

😛

I’m kind of lost here… can you attach the TXT file(s) too? :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 8:07am UTC](https://forum.kirupa.com/t/can-a-variable-be-dynamic/29269/5 "2003-08-25T08:07:47Z")

</div>

Ok, let me explain a little. I am using cgi to right to a text file; this text file is what you would see in side of the text box. The part I am asking about has to do with sending a variable to cgi like “m1”. I want the “var” to be dynamic. Inside of the 1st two menu buttons you will see menuPage = “m1” and menuPage = “m2”. When I click on the soups button the variable menuPage = m2. So when I click on the save work button the code that goes

```auto

var menuPage = menu_txt1;

```

really should read

```auto

var m2 = menu_txt1;

```

because menuPage equals m2.

I kind of see what my own problem is, there is a difference between the variable:  
number = 1  
vs  
var number = 1  
I am trying to make the variable “number” = two different things at once. I am hoping there is a way around this.

Hope this sheds some light.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 25, 2003, 12:14pm UTC](https://forum.kirupa.com/t/can-a-variable-be-dynamic/29269/6 "2003-08-25T12:14:50Z")

</div>

Oh! Ok. I think I got it. :sigh:

Assuming that menuPage equals “m1”:  
[AS]var menuPage = “m1”;[/AS]  
To read the actual variable, m1, you’d use:  
[AS]this[menuPage];[/AS]  
[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12082](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=12082)

…I think I’ll shoot myself if I’m right, that was so easy. 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 26, 2003, 12:28am UTC](https://forum.kirupa.com/t/can-a-variable-be-dynamic/29269/7 "2003-08-26T00:28:50Z")

</div>

All good here, thank you very much for your time kode. So it looks like you can call a variable 3 ways:

number =1  
var number = 1  
this.number = 1

Any thoughts on the major differences of these variable callls.

(-:🙂
