Help! Loadmovie using levels?

Hello all,
I’m new here and while seasoned with flash, I’m a total n00b when it comes to AS, still :frowning:

So, here’s my problem, I’m hoping someone may be able to help…

I have a main swf movie that loads other swfs into into level 1. The first is “intro.swf”, next is “01.swf”, “02.swf” and so forth… At the end of “introl.swf” the last frame says: [AS]loadMovieNum(“01.swf”, 1);[/AS] … and it just goes through the rest of the loadable movies throughout playback… no problem.

In my main swf, I have playback controls… I want to be able to control the swfs in a next chapter and previous chapter manner, so that i can skip to the next chapter at the press of a button…

I know this is wrong and I’m embarrassed to say that I could be way off track here, but this is what I currently have:

on (release) {
	if (_root._level1 == "intro.swf") 
		loadMovieNum("01.swf", 1);
	 else if (_root._level1 == "01.swf") 
		loadMovieNum("02.swf", 1);
	 else if (_root._level1 == "02.swf") 
		loadMovieNum("03.swf", 1);
	 else if (_root._level1 == "03.swf") 
		loadMovieNum("04.swf", 1);
	 else if (_root._level1 == "04.swf") 
		loadMovieNum("05.swf", 1);
}

Does anyone have any input? I am trying to basically skip to the next chapter within that level1 there…

Any comments would be greatly appreciated… Thanks in advance!!

Well there may be a better way of doing this… but I’m not all that sure how. I would solve that lack of knowledge very simply. I would create a variable on the main timeline called currentMov. This would be set to “intro” initially, and the button might look like the following.

on (release) {
        if (_root.currentMov == "intro")
        loadMovieNum("01.swf", 1);
        _root.currentMov="01";
        else if (_root.currentMov == "01")
        loadMovieNum("02.swf", 1);
        _root.currentMov="02"
        else if (_root.currentMov == "02")
        loadMovieNum("03.swf", 1);
        _root.currentMov="03";
        else if (_root.currentMov == "03")
        loadMovieNum("04.swf", 1);
        _root.currentMov="04";
        else if (_root.currentMov == "04")
        loadMovieNum("05.swf", 1);
        _root.currentMov="05";
}

originaly I was thinking that the “_name” property might retrieve the name from level1, but I’m not sure that’s how it works. The above method at least shouldn’t have any problems.

Thanks for the help, Up… I believe I’m much closer now!! but… I declared a variable on the main timeline that looks like this:


var currentMov = "intro.swf"

And on the button, I applied your recommended AS, but I get the resulting error…
*
Error Symbol=controller-prefs, layer=Layer 16, frame=15:Line 19: ‘else’ encountered without matching 'if’
else if (_root.currentMov == “01”)

Error Symbol=controller-prefs, layer=Layer 16, frame=15:Line 22: ‘else’ encountered without matching 'if’
else if (_root.currentMov == “02”)

Error Symbol=controller-prefs, layer=Layer 16, frame=15:Line 25: ‘else’ encountered without matching 'if’
else if (_root.currentMov == “03”)

Error Symbol=controller-prefs, layer=Layer 16, frame=15:Line 28: ‘else’ encountered without matching 'if’
else if (_root.currentMov == “04”)

Total ActionScript Errors: 4 Reported Errors: 4

(the line numbers are funny because I commented out my first attempt ;)) Again, I’m not too good with AS, so I don’t doubt that I’m making a simple mistake with my if/then statements… Any advice?

Thanks!

Try this instead:


on (release) {
        if (_root.currentMov == "intro"){
        loadMovieNum("01.swf", 1);
        _root.currentMov="01";
}      else if (_root.currentMov == "01"){
        loadMovieNum("02.swf", 1);
        _root.currentMov="02"
 }    else if (_root.currentMov == "02"){
      loadMovieNum("03.swf", 1);
        _root.currentMov="03";
  }      else if (_root.currentMov == "03"){
        loadMovieNum("04.swf", 1);
        _root.currentMov="04";
    }    else if (_root.currentMov == "04"){
        loadMovieNum("05.swf", 1);
        _root.currentMov="05";
}


I think the little { and }'s were missing…hope I put them all in the right place for ya.

Adam

Yeah, what’s weird is that I added the brackets, and when I do that, I get this:
*Error Symbol=controller-prefs, layer=Layer 16, frame=15:Line 15: Statement block must be terminated by '}'
on (release) {

Error Symbol=controller-prefs, layer=Layer 16, frame=15:Line 31: Syntax error.
}

Total ActionScript Errors: 2 Reported Errors: 2*

What’s weird is that, as you can see, I do have that last bracket in there, as it’s asking because of the second error… but it’s not picking it up :frowning:

So, it doesn’t like the first and last brackets if I have all the other brackets in there… I feel like I’m close, but still a bit off… :frowning: Thanks for your input so far… Any more advice? Is there a way to have all sets of brackets in there?

Can you copy and paste your exact code here?

adam can you help me load a movie into another one?

I’ll try, what is it you need to know?

Adam

well i did some of the tutorials on this site and made em my way and i want to put them on my flash web site but i dont know how to load them into it

You can create a blank MC, call it container and then use this code:


loadMovie("name_of_swf_file.swf", _root.container);

and this will load you swf into wherever you’ve positioned you blank MC in your main movie.

so i created empty movie clip and put the script in the clip but it loaded it and it loaded wrong…

can i send you the file and can you make it work?

can you post your fla here?

i dont know how…but ive seen people do it…and i think it might be too large

Ok, I don’t do public email, so is there anyway you can copy your code here, so I can see it?

there is the main movie then there is the movie clip which is a section and i put another empty movie clip inside it with this script
loadMovie(“tutorial_complete.swf”, _root.container);

i also did this
loadMovieNum(“tutorial_complete.swf”,1);
it worked fine except that it appeared on top left corner

if you want to have your empty movie clip inside another movie clip, you need to do this:


loadMovie("tutorial_complete.swf", _root.name_of_first_movieclip.container);

i did that and it does load but it doesnt work properly

what doesn’t work with it?