Variables in Clips

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-

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. :slight_smile: \r\rGood luck!

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!

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!