Flash Lite 2.x and 3 Help

Sound class

ActionScript for Flash Lite 2.x and later supports device sound through the Sound class and through System.capabilities values. The Sound class is fully supported for native sounds supported in Flash Player 7, but it is only partially supported for device sounds.

Flash Lite 2.x added support that lets you synchronize device sound playback with rendering animation.

NOTE

 

Flash Lite 2.x and later does not support sound recording.

Method summary

The following table lists the methods that are partially supported by the Sound class for when using ActionScript for Flash Lite 2.x and later.

Method

Description

Support

getPan()

Returns the pan level set in the last setPan() call as an integer from -100 (left) to +100 (right). (0 sets the left and right channels equally.) The pan setting controls the left-right balance of the current and future sounds in a SWF file.

Limitations: Supported for use with native Flash sound; not supported for use with device sound.

Partially supported

getTransform()

Returns the sound transform information for the specified Sound object set with the last Sound.setTransform() call.

Limitations: Supported for use with native Flash sound; not supported for use with device sound.

Partially supported

loadSound()

Loads an MP3 file into a Sound object. You can use the isStreaming parameter to indicate whether the sound is an event or a streaming sound.

Event sounds are completely loaded before they play. They are managed by the ActionScript Sound class and respond to all methods and properties of this class.

Limitations: The streaming parameter is ignored when used with Flash Lite 2.x and later.

Partially supported

setPan()

Determines how the sound is played in the left and right channels (speakers). For mono sounds, pan determines which speaker (left or right) the sound plays through.

Limitations: Supported for use with native Flash sound; not supported for use with device sound.

Partially supported

setTransform()

Sets the sound transform (or balance) information for a Sound object.

The soundTransformObject parameter is an object that you create using the constructor method of the generic Object class, with parameters specifying how the sound is distributed to the left and right channels (speakers).

Limitations: Supported for use with native Flash sound; not supported for use with device sound.

Partially supported

setVolume()

Sets the volume for the Sound object.

Limitations: Supported for use with native Flash sound; not supported for use with device sound.

Partially supported

Property summary

The following table lists the properties of the Sound class that are partially supported when using ActionScript for Flash Lite 2.x and later.

Property

Description

duration

The duration of a sound, in milliseconds.

Limitations: Supported for use with native Flash sound; not supported for use with device sound.

position

The number of milliseconds a sound has been playing.

Limitations: Supported for use with native Flash sound; not supported for use with device sound.

Flash Lite method extensions

The following table lists new methods in the Sound class that are specific to ActionScript for Flash Lite 2.x and later.

Method

Description

getPan()

Returns the value of the previous setPan() call. This method is not supported for device sound.

getTransform()

Returns the value of the previous setTransform() call. This method is not supported for device sound.

loadSound()

Loads sound data of any format into Flash Player.

This method is different from the Flash Player 7 implementation because sound data loaded using this method is always treated as event sound. Therefore, the second parameter of this method is always ignored. In the following example, the value true is ignored:

my_sound.loadSound("mysnd.mp3", true);

 

Send me an e-mail when comments are added to this page | Comment Report