# Help! Loadmovie using levels?

**URL:** https://forum.kirupa.com/t/help-loadmovie-using-levels/42616
**Category:** flash
**Created:** [February 11, 2004, 3:28am UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616 "2004-02-11T03:28:55Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![noka](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/noka/32/435_2.png) [@noka](https://forum.kirupa.com/u/noka)
#### Post date: [February 11, 2004, 3:28am UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/1 "2004-02-11T03:28:55Z")

</div>

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:

```auto
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!!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 11, 2004, 6:14am UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/2 "2004-02-11T06:14:01Z")

</div>

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.

```auto
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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 11, 2004, 5:58pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/3 "2004-02-11T17:58:49Z")

</div>

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:

```auto

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!

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 11, 2004, 9:05pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/4 "2004-02-11T21:05:05Z")

</div>

Try this instead:

```auto

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 12, 2004, 5:00pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/5 "2004-02-12T17:00:30Z")

</div>

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 ☹

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?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 12, 2004, 8:43pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/6 "2004-02-12T20:43:06Z")

</div>

Can you copy and paste your exact code here?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 9:53pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/7 "2004-02-13T21:53:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 9:56pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/8 "2004-02-13T21:56:54Z")

</div>

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

Adam

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 9:58pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/9 "2004-02-13T21:58:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 10:16pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/10 "2004-02-13T22:16:40Z")

</div>

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

```auto

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.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 10:34pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/11 "2004-02-13T22:34:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 10:35pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/12 "2004-02-13T22:35:30Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 10:41pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/13 "2004-02-13T22:41:15Z")

</div>

can you post your fla here?

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 10:46pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/14 "2004-02-13T22:46:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 10:48pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/15 "2004-02-13T22:48:35Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 10:50pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/16 "2004-02-13T22:50:41Z")

</div>

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);

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 10:59pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/17 "2004-02-13T22:59:52Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 10:59pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/18 "2004-02-13T22:59:56Z")

</div>

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

```auto

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

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 11:01pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/19 "2004-02-13T23:01:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [February 13, 2004, 11:03pm UTC](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616/20 "2004-02-13T23:03:05Z")

</div>

what doesn’t work with it?

[Next page](https://forum.kirupa.com/t/help-loadmovie-using-levels/42616.md?page=2)
