# Variables in Clips

**URL:** <https://forum.kirupa.com/t/variables-in-clips/2541>\
**Category:** flash\
**Created:** [June 12, 2002, 12:10am UTC](https://forum.kirupa.com/t/variables-in-clips/2541 "2002-06-12T00:10:27Z")\
**Posts on this page:** 4\
**Page:** 1

<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:** [June 12, 2002, 12:10am UTC](https://forum.kirupa.com/t/variables-in-clips/2541/1 "2002-06-12T00:10:27Z")

</div>

Sorry guys, this will be my last question for awhile because I fear I might be wearing out my welcome… I am having trouble with a variable in a movie clip. How do you get the movie to recognize a variable contained within a clip? Also, what is wrong with the dot notation in the code below? It jumps to the main movie’s timeline and not the clip… Thanks!\r\rNOTE: The “\_root:content” is where I am trying to figure out how to get the variable from the clip to be recognized by the whole movie. The “\_root.mctextbox” line is where something is wrong with my dot notation. The movieclip is contained on a layer in the main timeline. \r\ron (release) {\r mover = 1;\r if (\_root:content == 1) {\r gotoAndPlay("\_root.mctextbox", 12);\r }\r if (\_root:content == 2) {\r gotoAndPlay("\_root.mctextbox", 35);\r }\r if (\_root:content == 3) {\r gotoAndPlay("\_root.mctextbox", 54);\r }\r if (\_root:content == 4) {\r gotoAndPlay("\_root.mctextbox", 70);\r }\r}\r\r\r-brad-

---

<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:** [June 12, 2002, 2:06am UTC](https://forum.kirupa.com/t/variables-in-clips/2541/2 "2002-06-12T02:06:50Z")

</div>

Hey Brad!\r\rcouple of problems…\r\rfirst:\r\ryour if statements start with if (\_root:content == 1) \r\ryou’re using : when you should be using . as in \_root.content\r\rsecond:\r\rthe use of gotoandPlay is incorrect here. gotoandplay uses the arguments scene, frame. gotoandplay(“scene”, frame)\r\rmctextbox is an MC, not a scene. Therefore, it would not work. The appropriate use of gotoandplay would be (in Flash MX) \r\rmc.gotoandplay(frame)\r\rtherefore, your code should read:\r\r\_root.mctextbox.gotoandplay(12);\r\rthird:\r\rAsk away! As long as you ask good/reasonable questions, I am certain everyone is willing to help. I’d suggest you don’t ask one of us to build a Mahjong game for you. 🙂 \r\rGood luck!

---

<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:** [June 12, 2002, 2:38am UTC](https://forum.kirupa.com/t/variables-in-clips/2541/3 "2002-06-12T02:38:34Z")

</div>

Haha no…no Mahjong game for me… Thanks for your reply montoya and for explaining how gotoandplay works. I really appreciate it as I have no coding experience before Actionscript and it does get a little confusing at times!

---

<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:** [June 12, 2002, 5:57pm UTC](https://forum.kirupa.com/t/variables-in-clips/2541/4 "2002-06-12T17:57:30Z")

</div>

Hey I have a question above that maybe I didn’t explain. How do I get the main movie to recognize a variable contained within a movie clip. The use of a button depends on a variable contained within mctextbox. So, how can I utilize this variable from the main movie? Thanks!
