How do I pass a variable from a button to a MC instance to tell it which SWF to Load?

I’m sure this is pretty straightforward stuff, but I’m really just starting to get a handle on general actionscript - so any help would be tremendously appreciated.

Here’s what I’m trying to do:

I have a parent container movie that has several buttons on it. As it stands now the buttons trigger an instance of a MC on the main timeline to play using the “with” action (no biggie)

I would like to put a frame action in that MC instance that uses the “LoadMovieNum” action to load a particular external SWF movie into the container movie depending on which button the user clicked.

In theory I guess I need to somehow associate each button with it’s corresponding SWF child movie that is to be loaded (SetVariable?)

Then I need to pass that information to the MC instance in the main timeline that actually uses the LoadMovieNum command to load the SWF file.

Help anybody teach me how to do this, preferably without embarrassing me too much :slight_smile:

Thanx in advance,

jOEL

You can store the data with your button an retrieve it with your clip rather than pass from 1 to another. The obvious container would be the _root.

on (press){
  // do stuff
  // _root.myMovie="firstMovie.swf";
}

// then in your clip
loadMovieNum(_root.myMovie,level);

pom :asian:

Hey, J…

I believe all you need on a particular button…

on(release){
if(_root.loaded!=1){
loadVariablesNum();
_root.loaded=1;
}
}

the _root.loaded part is simply a switch, so you dont end up loading the same movie more than once. If you have more than one button (of course), your _root.loaded value will change to 2 for button 2, 3 for button 3, etc…

Hope that helps.

well, Ilyas beat me to it again…

a million ways to do these things in Flash, Joel…

:stuck_out_tongue: Come on, Neo, you’re faster than this ![SIZE=1]for Matrix fans…[/SIZE]

let’s race!hehehehhe j/k It’s hard to this while on a conference call most of the day. Can you tell my conference call is boring?

RatS! I don’t remember if I took the blue pill or the red pill…

Thanx to you both!

I really appreciate it…I’ll get crackin on it right now.

First on the button i define a variable of “MovieClip” and set it to “theSetup.swf”

then I tell the MC instance “_root.Doors” to play…like so:

on (release) {
MovieClip = “TheSetup.swf”;
with (_root.Doors) {
play();
}
}

Then in the MC instance “Doors” I have a frame action:

loadMovieNum(MovieClip value, _root.MasterSwap);

“MasterSwap” is the MC that is to be swapped out with the newly loaded SWF file. How do I load the MovieClip value that was set when the mouse was pressed?