Does anyone know how to keep track of loaded MCs? I have a navigation system loading content MCs. The problem is, when I choose another nav button, I want it to (onPress) figure which clip is currently loaded then gotoAndPlay a frame label in that clip, which will play an exit animation and load the content area corresponding to the newly pressed button.
Someone on Flashkit suggested having the loaded content MC send a variable to the main time line to act as a kind of flag to say which section is active but I’m not sure how to go about doing this.
Any direction or help is greatly appreciated here.
Each content clip has two frame lablels called “enter” and “exit” situated in exactly the same place.
Okay, so lets say the “news” section loads when the root movie loads. So, now I have a variable named loadedMovie whose value is the string “news”.
Now, in my main navigation I have 3 MCs acting as nav buttons. So, if I wanted to script the buttons to call the variable could I do something like this?
ex: portfolio button:
on (release) {
loadedMovie.gotoAndPlay(“exit”);
_root.contents.loadMovie(“portfolio.swf”);
}
My thinking is that on release, it’s going to go to the exit frame label no matter which content clip is loaded and play the exit animation. Then load the appropriate swf file. Is this correct? Will it wait for “exit” to finish playing before loading up the next clip?
on (release) {
loadedMovie.gotoAndPlay(“exit”); [COLOR=royalblue] <—this line won´t work[/COLOR]
_root.contents.loadMovie(“portfolio.swf”); [COLOR=royalblue] <—even if the last line worked, with this line you load the next movie, but the previous won´t wait for that[/COLOR]
}
the best way to do what you want is:
load all content mcs in the same level (lets say level 1), and on the buttons of the main movie place this code:
on (release) {
_level1.loadedMovie = [COLOR=red]“movieToBeLoaded”;[/COLOR]
_level1.gotoAndPlay(“close”);
}
and on your to be loaded movies, on the last frame place this code:
That’s awesome! I’m still trying to get a grasp on what the code is actually doing, though…tying my head in knots. :sigh: as easy as it may be. Will this work the same if I’m loading the content swfs into an empty mc on the root timeline named content?
Button code:
on (release) {
_root.content.loadedMovie = “movieToBeLoaded”;
_root.content.gotoAndPlay(“close”);
}
I just got it to work with a target MC. Yay me! Heh.
What I’m not getting is the logical order of how the entire thing is working especially with the variable. Like how each individual part is communicating with one another. I want to get a grasp on this so I can figure out how to add to it…like once the button is clicked, not having the animation repeat when it’s clicked again (when it’s content clip is the current clip).