Name
Sound.start( ) Method —
begin playing an attached sound
Availability
Flash 5
Synopsis
soundObject.start(secondOffset, loops)
Arguments
- secondOffset
A floating-point number indicating the time in seconds at which to start playing the sound attached to
soundObject(often called anentry point). For example, asecondOffsetof 1 starts playback one second after the sound’s actual beginning as defined in the Library. The default is 0. There is no provision for an exit point (the time at which to stop playing the sound). The sound plays until its end unless stopped manually.
- loops
A positive integer indicating how many times to play the sound attached to
soundObject. To play the sound once, use 1 (which is the default); to play the sound twice in succession, use 2, and so on. The portion of the sound fromsecondOffsetis repeated to its end the number of times specified byloops.
Description
The start( ) method is used to play
programmatically-defined sounds that were added to
soundObject via attachSound(
). The start( ) method does not play
all the sounds in a clip or movie; it plays only the sound most
recently attached to soundObject via
attachSound( ).
To play only a portion of the sound attached to
soundObject, use the
secondOffset argument. To play the sound
attached to soundObject repeatedly, use
the loops argument.
Example
// Create a new Sound object boink = new Sound( ); // Attach a sound exported asboinkto the Sound object boink.attachSound("boink"); // Play all of boink;soundOffset ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access