Sunday, March 14, 2010

flash.media.sound (ActionScript 3.0)

The Sound class lets you work with sound in an application. The Sound class lets you create a new Sound object, load and play an external MP3 file into that object, close the sound stream, and access data about the sound, such as information about the number of bytes in the stream and ID3 metadata. More detailed control of the sound is performed through the sound source — the SoundChannel or Microphone object for the sound — and through the properties in the SoundTransform class that control the output of the sound to the computer's speakers.

To control sounds that are embedded in a SWF file, use the properties in the SoundMixer class.

When you use this class, consider the following security model:

* Loading and playing a sound is not allowed if the calling file is in a network sandbox and the sound file to be loaded is local.

* By default, loading and playing a sound is not allowed if the calling is local and tries to load and play a remote sound. A user must grant explicit permission to allow this.

* Certain operations dealing with sound are restricted. The data in a loaded sound cannot be accessed by a file in a different domain unless you implement a cross-domain policy file. Sound-related APIs that fall under this restriction are Sound.id3, SoundMixer.computeSpectrum(), SoundMixer.bufferTime, and the SoundTransform class.

However, in Adobe AIR, content in the application security sandbox (content installed with the AIR application) are not restricted by these security limitations.

Nishan Shanaka Korala Gamage
Colombo, Sri Lanka
Author: Eye Think

No comments:

Post a Comment