Hello all,
I’m new here and while seasoned with flash, I’m a total n00b when it comes to AS, still
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?
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) {
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
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… Thanks for your input so far… Any more advice? Is there a way to have all sets of brackets in there?
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);