S > Sound.onSoundComplete

 

Sound.onSoundComplete

Availability

Flash Player 6.

Usage

mySoundObject.onSoundComplete = callbackFunction

Parameters

mySoundObject A Sound object.

callbackFunction A function.

Returns

Nothing.

Description

Event; invoked automatically when a sound finishes playing. You can use the onSoundComplete event to trigger events in a movie based on the completion of a sound.

You must create a function that executes when the onSoundComplete event is invoked. You can use either an anonymous function or a named function.

Example

Usage 1: The following example uses an anonymous function:

s = new Sound();
s.attachSound("mySound");
s.onSoundComplete = function() { trace("mySound completed"); };
s.start();

Usage 2: The following example uses a named function:

function callback1() {
trace("mySound completed");
}

s = new Sound();
s.attachSound("mySound");

s.onSoundComplete = callback1;

s.start();