Ok, so here’s the system:
Every external swf will have an intro part, a part that shows the content, and an outro. So let’s say frame 1-77 intro, 78 stop, 79-160 outro for example. This will work together with the buttons on the main swf: when we click one of those buttons, we want the swf to play it’s outro. Let’s start from there an build our way to the final script.
So let’s say we have a movieclip called container on the main swf in which we load the sections. Then the script for the buttons will be:
on(release){
_parent.container.play();
}
But, we only want it to play when it has reached it’s frame at where it stops. How do we know ? We’ll place a variable in the external swf that holds the framenumber of the frame at which it stops, and then we’ll ahve the button check if it matches with it’s currentframe.
So add this to the first frame of every swf:
midframe=78
Of course, I’m just taking 78 as example value here. And place this on your button
on(release){
if(_parent.container._currentframe == _parent.container.midframe){
_parent.container.play();
}
}
Ok. Now, we want to load another movie to container when the current section playing it’s outro has reached it’s last frame. But the external swf doesn’t know what button we clicked and therefore neither what swf it has to load. So we’ll store a variable in _root, so the section can access it too, that stores the movieclip to load:
on (release) {
if (_root.currMovie == undefined) {
_root.currMovie = "work";
_parent.container.loadMovie("work.swf");
} else if (_root.currMovie != "work") {
if (_parent.container._currentframe == _parent.container.midframe) {
_root.currMovie = "work";
_parent.container.play();
}
}
}
And at the last frame of each of your swfs:
_root.container.loadMovie(_root.currMovie+".swf");
Notice that we are always loading [_root.currMovie].swf. Therefore, you must make sure that you only give the names of your swfs to _root.currMovie when pressing the buttons. So if you have the swfs a.swf, b.swf and c.swf for example, you must give _root.currMovie the values a b and c when pressing the buttons. Otherwise it will try to load non-exisiting swfs.
I hope I didn’t forget anything.
*Fixed a typo.