Adding Sound > About the onSoundComplete event |  |

About the onSoundComplete event

The `onSoundComplete` event of the ActionScript Sound object enables you to trigger an event in a movie based on the completion of an attached sound file. The Sound object is a built-in object that lets you control sounds in a movie. For general information on objects, see Understanding the ActionScript Language. For specific information on the Sound object and its methods, see Sound (object) in the ActionScript Dictionary.

The `onSoundComplete` event of a Sound object is invoked automatically when the attached sound file finishes playing. If the sound is looped a finite number of times, the event is triggered when the sound finishes looping.

The Sound object has two properties that you can use in conjunction 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 enables you to manipulate sounds in a variety of powerful 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 half over