# Keeping a movie loaded, even while changing scenes?

**URL:** https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807
**Category:** flash
**Created:** [July 16, 2003, 6:32pm UTC](https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807 "2003-07-16T18:32:46Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![nauds](https://avatars.discourse-cdn.com/v4/letter/n/fbc32d/32.png) [@nauds](https://forum.kirupa.com/u/nauds)
#### Post date: [July 16, 2003, 6:32pm UTC](https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807/1 "2003-07-16T18:32:46Z")

</div>

Im trying to keep a sound clip loaded thruout my movie, it works fine on each individual scene but when I switch scenes it unloads it.

Anyway to keep it static thruout all the scenes?

---

<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: [July 16, 2003, 6:56pm UTC](https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807/2 "2003-07-16T18:56:02Z")

</div>

why are you using scenes? I always was told scenes are hazardous to your movie’s health…

---

<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: [July 16, 2003, 6:56pm UTC](https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807/3 "2003-07-16T18:56:26Z")

</div>

Define a Sound object instance and load the sound. It should play through all the scenes. 🙂  
[AS]mySound = new Sound();  
mySound.loadSound(“mySound.mp3”, true);[/AS]  
[http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary654.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary654.html)

**Edit.** I agree, Random Hero. 😛

---

<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: [July 16, 2003, 7:02pm UTC](https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807/4 "2003-07-16T19:02:43Z")

</div>

Its not a .mp3

It’s a .swf that has 5 sounds on it, which is why im using load movie =o

… and yes I totally agree now after building an entire movie in scenes that they are the worst =(

---

<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: [July 16, 2003, 7:04pm UTC](https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807/5 "2003-07-16T19:04:36Z")

</div>

Then create a MovieClip and load the SWF. 😛  
[AS]this.createEmptyMovieClip(“soundMC”, 9876);  
soundMC.loadMovie(“sound.swf”);[/AS]

---

<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: [July 16, 2003, 8:02pm UTC](https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807/6 "2003-07-16T20:02:46Z")

</div>

sweet! it worked, thank ya

now if I can only figure out how to set it under a certain layer

---

<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: [July 16, 2003, 8:07pm UTC](https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807/7 "2003-07-16T20:07:25Z")

</div>

[AS]MovieClip.createEmptyMovieClip(instanceName, depth);[/AS]  
Set the parameter _depth_ to a lower number. 😉

[http://www.macromedia.com/support/flash/action\_scripts/actionscript\_dictionary/actionscript\_dictionary512.html](http://www.macromedia.com/support/flash/action_scripts/actionscript_dictionary/actionscript_dictionary512.html)

---

<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: [July 16, 2003, 8:11pm UTC](https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807/8 "2003-07-16T20:11:58Z")

</div>

how do I determine the depth I need to set the movie clip at?

---

<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: [July 16, 2003, 8:20pm UTC](https://forum.kirupa.com/t/keeping-a-movie-loaded-even-while-changing-scenes/25807/9 "2003-07-16T20:20:31Z")

</div>

You could use the MovieClip.getDepth method.

Let’s say you want put soundMC under a MovieClip called myOtherClip…  
[AS]var depth = myOtherClip.getDepth()-1;  
this.createEmptyMovieClip(“soundMC”, depth);[/AS]  
Beware, you can’t have two instances at the same depth, if a MovieClip already exists at that depth, it will be replaced by the newly created MovieClip.

There’s also Button.getDepth and TextField.getDepth, by the way.
