# SOUND\_COMPLETE event does not trigger

**URL:** <https://forum.kirupa.com/t/sound-complete-event-does-not-trigger/228262>\
**Category:** flash\
**Created:** [June 6, 2007, 3:38pm UTC](https://forum.kirupa.com/t/sound-complete-event-does-not-trigger/228262 "2007-06-06T15:38:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stag](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/stag/32/3707_2.png) [@stag](https://forum.kirupa.com/u/stag)\
**Post date:** [June 6, 2007, 3:38pm UTC](https://forum.kirupa.com/t/sound-complete-event-does-not-trigger/228262/1 "2007-06-06T15:38:55Z")

</div>

I am working with a short vocal track and when the audio ends I would like a replay button to appear. The codes should work fine, no errors appear. Trace displays nothing…

Here is some of the code:

var clip = “testClip.mp3”;

```
//Create the Sound & SoundChannel Objs
var soundReq:URLRequest = new URLRequest(clip);
var sound:Sound = new Sound();

var soundControl:SoundChannel = new SoundChannel();
var resumeTime:Number = 0;

sound.load(soundReq);
sound.addEventListener(Event.COMPLETE, onComplete);
soundControl.addEventListener(Event.SOUND_COMPLETE, onPlaybackComplete);
trace(sound.length);

//instants player event listners 
function onComplete():void {
    play_btn.addEventListener(MouseEvent.CLICK, playSound);
    pause_btn.addEventListener(MouseEvent.CLICK, pauseSound);
    
    //player_btn.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
}

//onmouseout event
function playSound(Event:MouseEvent):void {
    soundControl = sound.play(resumeTime);
    pause_btn.visible = true;
    pause_btn.addEventListener(MouseEvent.CLICK, pauseSound);
    play_btn.visible = false;
    play_btn.removeEventListener(MouseEvent.CLICK, playSound);

    }

//onmouseover event

```

function onMouseOut(Event:MouseEvent):void {  
soundControl.stop(); }

function pauseSound(Event:MouseEvent):void {  
resumeTime = soundControl.position;  
soundControl.stop();  
play\_btn.visible = true;  
play\_btn.addEventListener(MouseEvent.CLICK, playSound);  
pause\_btn.visible = false;  
pause\_btn.removeEventListener(MouseEvent.CLICK, pauseSound);

```
    }

```

function onPlaybackComplete(event:Event):void  
{  
trace(“The sound has finished playing.”);  
}
