# Variable problem

**URL:** <https://forum.kirupa.com/t/variable-problem/18367>\
**Category:** flash\
**Created:** [April 15, 2003, 10:51pm UTC](https://forum.kirupa.com/t/variable-problem/18367 "2003-04-15T22:51:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![crazygamer](https://avatars.discourse-cdn.com/v4/letter/c/df788c/32.png) [@crazygamer](https://forum.kirupa.com/u/crazygamer)\
**Post date:** [April 15, 2003, 10:51pm UTC](https://forum.kirupa.com/t/variable-problem/18367/1 "2003-04-15T22:51:51Z")

</div>

I’m trying to make a variable that changes when a MC is on a certain frame. I tried to trace the variable both from the mc and the main timeline, however only the mc game me the correct value and the main timeline returned undefined. Is there any way I can make a variably inside of a MC that I can use from the main timeline?

---

<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:** [April 15, 2003, 10:55pm UTC](https://forum.kirupa.com/t/variable-problem/18367/2 "2003-04-15T22:55:23Z")

</div>

you can define a global variable in your main timeline, by using:

[AS]\_global.myVar = value;[/AS]

read up on global variables [here](http://www.kirupa.com/developer/actionscript/tricks/global.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:** [April 15, 2003, 10:59pm UTC](https://forum.kirupa.com/t/variable-problem/18367/3 "2003-04-15T22:59:22Z")

</div>

finally my everlasting problem with variables has been solve…thanx a lot man
