
Sound.duration Property
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
773
Sound.duration Property
the total length of the sound, in milliseconds
Flash 6
read-only
soundObject.duration
Description
The duration property returns the length, in milliseconds, of the attached or loaded sound
associated with
soundObject. It does not apply to timeline sounds placed at authoring time.
If multiple sounds are loaded into a single
soundObject, the duration property reflects the
most recently loaded sound. If the sound is looped,
duration returns the length of one
loop. If no attached or loaded sound exists,
duration returns undefined. While an external
streaming sound is loading,
duration reflects the length of the sound loaded so far. While
an external event sound is loading,
duration stores 0 until the sound has completely
loaded, at which point it stores the actual length of the sound. Theoretically,
duration
should be available from Sound.onLoad(), but a bug in Flash 6 prevents access to it (see the
following Bugs).
The
duration property can be used with position to determine the percentage of a sound
that has played so far. See
Sound.position for example code that increases the volume of a
sound proportionate to the percentage played.
Bugs
In Flash 6, when a sound is exported from the Library and loadSound() is invoked ...