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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I set variable on 1 movie and access on another? 1

Status
Not open for further replies.

rick1111

Programmer
Nov 25, 2001
16
US
Movie 1 is a map. Each state has a button. When the button for a state is clicked it loads another movie (all states load the same movie). When the second movie starts running I want to know which state it was selected from. Thanks in advance for the help.
 
If each state really has it's own button, then simply set a variable on press of that button, and do whatever you want with that variable.

on (press){
_root.selected_state = "Kansas";
_root.mcinstance'sname.play();
}

...But something says to me... It's not that simple!
What info have you omitted?

Regards,
wink4.gif
ldnewbie
 
Sorry, just re-read your post, and will correct my answer:

Assuming you would load an external movie, set the variable with:
_level0.selected_state = "Kansas";

Then from the loaded movie you would refer to this variable in the same manner:

If you wanted to display the state selected in a text field, you would then name the variable in the text box:
_level0.selected_state

If you wanted to send this loaded movie to a particular frame depending on the state selected, you could use a serie of if and/or elses:

if(_level0.selected_state == "Kansas") {
_root.gotoAndPlay("labeled_frame");
} else {
do something else...
}

Note: in this case _root refers to main timeline in the loaded movie and not the main timeline of the map movie which is on level 0.
wink4.gif
ldnewbie
 
Thanks for your help Oldnewbie and you are correct. Here is more detail.

Your assumption was correct, each state has it's own button and I am already doing as you suggested on the setvariable.
on (release) {
_root.State1 = 'Ga";
loadMovieNum ("Test1.swf", 0);
}

The problem happens when the Test1 movie runs. I have a dynamic text field in the movie but so far have been unsuccessful getting the value in the Test1 variable.

Sorry for the omission.
 
Did my second post answer your question?

Regards,

wink4.gif
ldnewbie
 
Thanks again for the fast responses and I hate to be a pain but even when I tried your suggestion I still do not get the variable in the Test1 movie. I do not have an action defined on the Test1 movie, but I did name the dynamic text field as you suggested.

This seems like it should be very simple, but I just can't get the puppy to bark.

 
Well... Just did it and it works!

On the button in the main map movie:

on (press){
_level0.selected_state = "TX";
}

A text field in the loaded movie named _level0.selected_state (no ""), displays TX...

Double check that the text field variable is really exactly named as you've declared it. Also check that the text color (in the text field) is not the same as the background color, thus making it invisible, and/or check the border & background box in the text field options.

It should work!

Regards,
wink4.gif
ldnewbie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top