
Sound.attachSound() Method
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Alphabetical Language Reference
|
771
A sound does not stop playing when the object that controls it is
deleted. Use Sound.stop() to halt the playback of loaded or attached
sounds.
See Also
capabilities.hasAudio, stopAllSounds(); _soundbuftime
Sound.attachSound() Method
associate a sound from the Library with a Sound object
Flash 5
soundObject.attachSound(linkageIdentifier)
Arguments
linkageIdentifier
The name of the sound to attach, as specified in the Library under Options
➝
Linkage.
Description
The attachSound() method places an exported Library sound under soundObject’s control.
Once attached, the sound can be started and stopped individually by invoking start() and
stop() on
soundObject. For instructions on pausing a sound, see the online technote posted
at:
http://www.moock.org/asdg/technotes/pauseSound/
In order for a sound to be attached to
soundObject, the sound must be exported from the
movie’s Library. To export a sound, follow these steps:
1. In the Library, select the sound to export.
2. Select Options
➝ Linkage. The Linkage Properties dialog box appears.
3. Under Linkage, select Export For ActionScript.
4. In Flash 6, optionally uncheck the “Export in first frame” checkbox.
5. In the Identifier box, enter a unique name by which to identify the sound.
In Flash