Flash CS3  |  Go to CS4 Help

About the ActionScript 2.0 onSoundComplete event

The onSoundComplete event of the ActionScript 2.0 Sound object lets you trigger an event in a Flash application based on completing an attached sound file. The Sound object is a built-in object that lets you control sounds in a Flash application. For more information, see Sound in the ActionScript 2.0 Language Reference. The onSoundComplete event of a Sound object is invoked automatically when the attached sound file finishes playing. If the sound is looped a specified number of times, the event is triggered when the sound finishes looping.

The Sound object has two properties that you can use with the onSoundComplete event. The duration property is a read-only property representing the duration, in milliseconds, of the sound sample attached to the sound object. The position property is a read-only property representing the number of milliseconds the sound has been playing in each loop.

The onSoundComplete event lets you manipulate sounds in a many ways, such as the following:

  • Creating a dynamic playlist or sequencer

  • Creating a multimedia presentation that checks for narration completion before advancing to the next frame or scene

  • Building a game that synchronizes sounds to particular events or scenes and transitions smoothly between different sounds

  • Timing an image change to a sound—for example, changing an image when a sound is halfway through at playback time

Comments

Comments are no longer accepted for Flash CS3. Flash CS4 is the current version. To discuss Flash CS3, please use the Adobe forum.