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

Going from the main SWF file to a child file and back again

Status
Not open for further replies.

FrankyTheFish

Programmer
Sep 7, 2002
14
0
0
CA
Hey guys, we're looking at one of the final problem flash is causing us.

In the following code you can see what we do load our flash game. WE have 2 seperate levels which we call. Now once we're in level 1 what can be done to tell level 1 to end so that level 2 can start from the main file?

Again thanks for all the help. You guys are great.

Frank


// used right now to know which level to load for testing purposes.

var level:Number = 1;

menu=function()
{
////////////
// menu //
///////////
attachMovie("header_gui","GUI",1);
GUI._x=0;
GUI._y=0;
GUI._xscale=118;
GUI._yscale=120;

GUI.onPress=function()
{
GUI.play();

if(!level)
{
loadMovie("Level1.swf",5);
level=1-level;
}
else
{
loadMovie("Level2.swf",5);
level=1-level;
}
}
}

menu();
 
You have to use loadMovieNum to load movies on seperate levels. That is probably what is causing your problem.

So your code should look like this:\
Code:
if(!level)
        {
            loadMovieNum("Level1.swf",1);
            //level=1-level;
        }
        else
        {
            loadMovieNum("Level2.swf",2);
            //level=1-level;
        }

Once that is fixed you would simply add:

Code:
//assuming there is a stop action on the first frame of the level2 movie.
_level2.gotoAndPlay(2);
stop();

Hope it helps.
To the last frame of your level1 movie.

Wow JT that almost looked like you knew what you were doing!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top