# Variables

**URL:** <https://forum.kirupa.com/t/variables/7062>\
**Category:** flash\
**Created:** [October 23, 2002, 1:29am UTC](https://forum.kirupa.com/t/variables/7062 "2002-10-23T01:29:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![buddylee](https://avatars.discourse-cdn.com/v4/letter/b/e5b9ba/32.png) [@buddylee](https://forum.kirupa.com/u/buddylee)\
**Post date:** [October 23, 2002, 1:29am UTC](https://forum.kirupa.com/t/variables/7062/1 "2002-10-23T01:29:16Z")

</div>

I know in Visual Basic there is are two types of variables… local and global. Is there such a thing in Flash MX? For instance, if I create a varible such as “finish line = 20” for a movie clip, is that variable still true if I use it in a different movie clip? Or do I have to make it a varibale for the whole entire animation?  
If you cant understand, I will try to explain further.  
Thanks

---

<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:** [October 23, 2002, 5:28am UTC](https://forum.kirupa.com/t/variables/7062/2 "2002-10-23T05:28:11Z")

</div>

I can tell you, in Flash 5.0, that there are only local variables, but I do remember speak from the masters (Supra and Pom) about global variables and how to create them in MX, and how to artificialy imitate them in 5.0. I’d suggest doing a ‘search’ in the MX and Action script forum here using the keywords ‘global’ and ‘variables’. I’ll bet you’ll find the thread they were discussing it in.

---

<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:** [October 23, 2002, 8:43pm UTC](https://forum.kirupa.com/t/variables/7062/3 "2002-10-23T20:43:45Z")

</div>

Yes there is indeed global and local variables  
To properly use them you need to specify them as such:

finishLine = 20 //would be local to the movie clip it is in  
\_global.finishLine = 30 //would become global regardless of movie clip it is in.

Depending on the movie clip you are in you can refrence any variable using the specified path such as:

\_root.movieClipA.finishLine = 20

or

\_global.finishTime = \_root.movieClipA.finishLine

Just make sure you define the path to the variable and all will work superb!!!

I should also specify that you can use the same named variable in diffrent movie clips!

Hope this helps!

---

<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:** [October 23, 2002, 9:41pm UTC](https://forum.kirupa.com/t/variables/7062/4 "2002-10-23T21:41:53Z")

</div>

[SIZE=24] **RAHHHHH!!!** [/SIZE] Does anybody read the [AS tricks??](http://www.kirupa.com/developer/actionscript/as_tricks.asp) ☹

---

<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:** [October 23, 2002, 9:49pm UTC](https://forum.kirupa.com/t/variables/7062/5 "2002-10-23T21:49:20Z")

</div>

HOLY COW!!!  
It was there the whole time… 😉  
Thanks for the link…
