Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing variables with button in a movieClip 1

Status
Not open for further replies.

N3XuS

Programmer
Mar 1, 2002
339
BE
K, here's the deal, i'm quite fresh in Flash and got a problem. I need to be able to change a variable with a button that is within a movieclip. These variables keep track of wheter a window is open or not so that they would not overlap. Anyhow I declared the variable in the mainframe. (it's a one frame site with many clips.) When a normal button is pushed it plays a movieClip (which is another menu) and changes its variable to 1. So when another button is clicked I can check if the menu is open or not and the menu can be closed before a new one is opened and they don't overlap. Now this new menu is a movieclip with buttons that Also need to change variables, but they seem to be using these variable as if they are declared private in that button, and so I can't alter the actual var declared in the mainframe. How do I work around this. Also can I not change public variables within normal movieclips? so that the var would e.a. change in frame 10. when I do this it seems to alter again a private var and not the one declared in the frame. Can anyone PLEASE help me. Site 's got a deadline by tonight :(
Thx
 
Ah found it on this forum :)
Must be a real beginner huh. Only doing flash for a week now. They should make an all-code environment in Flash too, would be easyer to see the hiërarchy of the programming. For me that is :)
Ah, the answer simply was to get the var by using _root:myvariable
 
Just a note for you nexus..

Flash also supports _parent.myvariable Its best to keep everything modular in case you ever have to load this movie into another movie.. The movie calling it will become root and all your variable calls will not work. By going with relative paths you will always be safer.. Just a suggestion.

-Nukoi
 
wow, you just saved me LOADS of hassle :) Man I would've been in trouble if I was gonna load this movie into another one.
I'm not as newbie anymore:) Flash is so darn easy.

Many Thx
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top