# Event.SOUND\_COMPLETE not working 2 well

**URL:** <https://forum.kirupa.com/t/event-sound-complete-not-working-2-well/319170>\
**Category:** flash\
**Created:** [February 10, 2011, 7:11pm UTC](https://forum.kirupa.com/t/event-sound-complete-not-working-2-well/319170 "2011-02-10T19:11:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![outback](https://avatars.discourse-cdn.com/v4/letter/o/9f8e36/32.png) [@outback](https://forum.kirupa.com/u/outback)\
**Post date:** [February 10, 2011, 7:11pm UTC](https://forum.kirupa.com/t/event-sound-complete-not-working-2-well/319170/1 "2011-02-10T19:11:10Z")

</div>

Hi all

I’m having a real big problem with the Event.SOUND\_COMPLETE in Flash.

I have a movie that has a bunch of animations on diferent scenes the problem is that I need my movie to wait for my sound to finish before it goes to the next scene, when I use the sound complete it works fine on the first scene but it won’t go past that.

here are my codes any help is widely appreciated.

**scene 1  
frame 1**

```auto

import flash.media.Sound;
import flash.net.URLRequest;
import flash.display.Sprite;
import flash.media.SoundChannel;
import flash.events.Event;
import flash.events.MouseEvent;

autoPlay = true;
var _som1:Sound;
var _channel1:SoundChannel;
var nextsceneSoundloadComplete:Boolean;
var currentSound:String = "sound/ModelosAtomicos/cena1.mp3";
var nextSound:String = "sound/ModelosAtomicos/cena2.mp3"

if (_som1) {
    _channel1.stop();
    _som1=null;
    _channel1=null;
}

_som1 = new Sound();
_som1.addEventListener(Event.COMPLETE,soundloadComplete);
_som1.load(new URLRequest (currentSound));
stop();

function soundloadComplete(e:Event):void{
    _channel1 =_som1.play();
    dispatchEvent(new Event("volAdj"));
    play();
    preloadSound();
}

function preloadSound():void{
    var _som2:Sound = new Sound();
    _som2.addEventListener(Event.COMPLETE,preloadComplete);
    _som2.load(new URLRequest (nextSound));
}
function preloadComplete(e:Event):void{
    nextsceneSoundloadComplete = true;
    dispatchEvent(new Event("soundloadcomplete"));
}

function soundF(e:Event):void{
    if(hasEventListener("soundloadComplete")){
        removeEventListener("soundloadComplete",soundF);
    }
    _som1 = new Sound();
    _som1.load(new URLRequest(currentSound));
    _channel1 =_som1.play();
    dispatchEvent(new Event("volAdj"));
    play();
    if(nextSound){
        preloadSound();
        nextsceneSoundloadComplete = false;
    }
}

```

**scene 1  
last frame**

```auto

stop()
_channel1.addEventListener(Event.SOUND_COMPLETE, somCompleto)

function somCompleto(e){
    play()
}

```

**scene 2  
frame 1**

```auto

import flash.events.Event;

currentSound = "sound/ModelosAtomicos/cena2.mp3";
nextSound = "sound/ModelosAtomicos/cena3.mp3"

if (_som1) {
    _channel1.stop();
    _som1=null;
    _channel1=null;
}

stop();
if(nextsceneSoundloadComplete){
    soundF(null);
    nextsceneSoundloadComplete = false;
} else {
    addEventListener("soundloadComplete",soundF);
}

```

**scene 2  
last frame**

```auto

stop()
_channel1.addEventListener(Event.SOUND_COMPLETE, somCompleto)

```

thanks in advance…

And please be clear on your anwsers because I’m not that much of a programer.
