# Preloading external mp3, but shouldnt play until another scene is reached

**URL:** https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000
**Category:** Uncategorized
**Created:** [September 2, 2004, 6:25am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000 "2004-09-02T06:25:40Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![me\_cute](https://avatars.discourse-cdn.com/v4/letter/m/ed8c4c/32.png) [@me\_cute](https://forum.kirupa.com/u/me_cute)
#### Post date: [September 2, 2004, 6:25am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/1 "2004-09-02T06:25:40Z")

</div>

Hi, newbie here.

im stuck with preloading sounds. i want to preload mp3s into my movie, but the thing is that they shouldnt start playing when completly/partially loaded.

i want the mp3 to get completely loaded in the background(but shouldnt play as yet) .  
when some animation is completed and scene 2 is reached the mp3 should start playing.

any clues? i would be very greatful if someone could help me out here.

-britney

---

<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: [September 2, 2004, 6:48am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/2 "2004-09-02T06:48:26Z")

</div>

what are you having problems with exactly? actually preloading the sound file or just scripting it to not play until a condition has been met?

---

<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: [September 2, 2004, 6:50am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/3 "2004-09-02T06:50:34Z")

</div>

> [@maximum\_flash](#):
>
> what are you having problems with exactly? actually preloading the sound file or just scripting it to not play until a condition has been met?

well both, ☹ _sign_

---

<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: [September 2, 2004, 7:04am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/4 "2004-09-02T07:04:34Z")

</div>

Welcome to kirupaforums=)

Did you have a look at this  
[http://kennybellew.com/tutorial/](http://kennybellew.com/tutorial/)  
??

scotty(-:

---

<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: [September 2, 2004, 7:05am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/5 "2004-09-02T07:05:25Z")

</div>

```auto

//create a new sound, named sound_1
sound_1= new Sound();
 
//load the sound you want in your movie into your new sound object
sound_1.loadSound("your_sound.mp3", false)
 
//define a function to preload the sound
function checkLoad(){
var percentLoaded= (sound_1.getBytesLoaded()/sound_1.getBytesTotal()) *100;
progress.text= Math.round(percentLoaded)
}
 
//stops the sound from playing after it has loaded
sound_1.onLoad= function(success){
if (success){
this.stop()
}
}
 
//create a setInterval to call the preload function until the sound has loaded
checkProgress= setInterval(checkLoad, 1000);

```

on the stage you will need a dynamic text box with the variable name progress. as for your condition, i would say you should put something like this at the end of that animation timeline:

```auto

_root.sound_1.start();

```

that will play your sound (presumed to be on \_root)

i did this off top of my head, so there could be flaws. just get back if anything goes afray.

hope this helps a little. (if you dont know any actionScript you might be staring blank)

---

<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: [September 2, 2004, 7:11am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/6 "2004-09-02T07:11:45Z")

</div>

thanx guys (scotty and max flash)…i’m working on the thing u said… i’ll get back in a few… hope this works

---

<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: [September 2, 2004, 7:42am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/7 "2004-09-02T07:42:56Z")

</div>

for reference if you need any. i jigged something up real quick.

---

<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: [September 2, 2004, 7:47am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/8 "2004-09-02T07:47:39Z")

</div>

hi again. heres my file… i did what u told me…it doesnt stop at frame 1 and keeps on going to the next frames.

[http://www.geocities.com/b\_kreationz/1.swf](http://www.geocities.com/b_kreationz/1.swf)

here it should load “4.mp3”, a 3.5 mb mp3 file. and then goto frame 25… but it’s not workin.

i’ve attached the fla.  
thanx in advance for helping me out guys…really appreciate 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: [September 2, 2004, 7:56am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/9 "2004-09-02T07:56:54Z")

</div>

just like a charm.

---

<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: [September 2, 2004, 8:00am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/10 "2004-09-02T08:00:44Z")

</div>

the working, modified version of your file.

---

<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: [September 2, 2004, 8:07am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/11 "2004-09-02T08:07:07Z")

</div>

works offline …letme check online…brb

---

<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: [September 2, 2004, 8:18am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/12 "2004-09-02T08:18:22Z")

</div>

ok…online it keeps on displaing NaN…  
what do i do?

---

<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: [September 2, 2004, 8:19am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/13 "2004-09-02T08:19:32Z")

</div>

check the pathing… i put up [http://www.geocities.com/sammy\_o85/1.swf](http://www.geocities.com/sammy_o85/1.swf) for a test and it worked fine for me.

you need to make sure that the “4.mp3” is in the \*\*same \*\*folder as your 1.swf. if it is in a different one, you have to adjust your pathing on the loadSound. that is the only reason NaN would come up.

**i tested your site just now, it worked**

---

<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: [September 2, 2004, 8:25am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/14 "2004-09-02T08:25:00Z")

</div>

figured it out…it was geocities slow server…can i put the

\_root.sound\_1.start();

in any other frame …say like frame 20?

---

<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: [September 2, 2004, 8:27am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/15 "2004-09-02T08:27:37Z")

</div>

sure, but you need to make sure you have the sound preloaded before you let it play. i recommend you keep the gotoAndPlay() but instead of the frame label i made, just put in nextFrame so that the movie plays only after your sound has been loaded. that should do it for you.

well, im off to bed. any other questions, just post them up and me or someone else will do what we can.

good luck.

---

<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: [September 2, 2004, 8:29am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/16 "2004-09-02T08:29:28Z")

</div>

thanx max…you’ve been awesome

---

<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: [September 2, 2004, 8:30am UTC](https://forum.kirupa.com/t/preloading-external-mp3-but-shouldnt-play-until-another-scene-is-reached/63000/17 "2004-09-02T08:30:16Z")

</div>

tis what im here for.

later times.
