Sound


Object
    |
    +-Sound

public class Sound
extends Object

The Sound class lets you control sound in a movie. You can add sounds to a movie clip from the library while the movie is playing and control those sounds. If you do not specify a target when you create a new Sound object, you can use the methods to control sound for the whole movie.

You must use the constructor new Sound to create a Sound object before calling the methods of the Sound class.

Property summary

Modifiers

Property

Description

 

duration:Number [read-only]

The duration of a sound, in milliseconds.

 

id3:Object [read-only]

Provides access to the metadata that is part of an MP3 file.

 

position:Number [read-only]

The number of milliseconds a sound has been playing.

Properties inherited from class Object

constructor (Object.constructor property), __proto__ (Object.__proto__ property), prototype (Object.prototype property), __resolve (Object.__resolve property)


Event summary

Event

Description

onID3 = function() {}

Invoked each time new ID3 data is available for an MP3 file that you load using Sound.attachSound() or Sound.loadSound().

onLoad = function(success:Boolean) {}

Invoked automatically when a sound loads.

onSoundComplete = function() {}

Invoked automatically when a sound finishes playing.

Constructor summary

Signature

Description

Sound([target:Object])

Creates a new Sound object for a specified movie clip.

Method summary

Modifiers

Signature

Description

 

attachSound(id:String) : Void

Attaches the sound specified in the id parameter to the specified Sound object.

 

getBytesLoaded() : Number

Returns the number of bytes loaded (streamed) for the specified Sound object.

 

getBytesTotal() : Number

Returns the size, in bytes, of the specified Sound object.

 

getPan() : Number

Returns the pan level set in the last setPan() call as an integer from -100 (left) to +100 (right).

 

getTransform() : Object

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

 

getVolume() : Number

Returns the sound volume level as an integer from 0 to 100, where 0 is off and 100 is full volume.

 

loadSound(url:String, isStreaming:Boolean) : Void

Loads an MP3 file into a Sound object.

 

setPan(value:Number) : Void

Determines how the sound is played in the left and right channels (speakers).

 

setTransform(transformObject:Object) : Void

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

 

setVolume(value:Number) : Void

Sets the volume for the Sound object.

 

start([secondOffset:Number], [loops:Number]) : Void

Starts playing the last attached sound from the beginning if no parameter is specified, or starting at the point in the sound specified by the secondOffset parameter.

 

stop([linkageID:String]) : Void

Stops all sounds currently playing if no parameter is specified, or just the sound specified in the idName parameter.

Methods inherited from class Object

addProperty (Object.addProperty method), hasOwnProperty (Object.hasOwnProperty method), isPropertyEnumerable (Object.isPropertyEnumerable method), isPrototypeOf (Object.isPrototypeOf method), registerClass (Object.registerClass method), toString (Object.toString method), unwatch (Object.unwatch method), valueOf (Object.valueOf method), watch (Object.watch method)



Flash CS3


 

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

Current page: http://livedocs.adobe.com/flash/9.0/main/00005421.html