Sound
609
Example
The following example traces the ID3 properties of song.mp3 to the Output panel:
var my_sound:Sound = new Sound();
my_sound.onID3 = function(){
for( var prop in my_sound.id3 ){
trace( prop + " : "+ my_sound.id3[prop] );
}
}
my_sound.loadSound("song.mp3", false);
See also
attachSound (Sound.attachSound method)
,
loadSound (Sound.loadSound method)
loadSound (Sound.loadSound method)
public loadSound(url:
String
, isStreaming:
Boolean
) : Void
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.
Streaming sounds play while they are downloading. Playback begins when sufficient data is
received to start the decompressor.
All MP3s (event or streaming) loaded with this method are saved in the browser's file cache
on the user's system.
Note:
For Flash Lite 2.0, you can ignore the
isStreaming
parameter because Flash Lite 2.0
treats every sound as an event sound.
Availability:
ActionScript 1.0; Flash Lite 2.0
Parameters
url
:
String
- The location on a server of an MP3 sound file.
isStreaming
:
Boolean
- A Boolean value that indicates whether the sound is a streaming
sound (
true
) or an event sound (
false
).
Example
The following example loads an event sound, which cannot play until it is fully loaded:
var my_sound:Sound = new Sound();
my_sound.loadSound("song1.mp3", false);
Summary of Contents for FLASHLITE2 ACTIONSCRIPT-LANGUAGE
Page 1: ...Flash Lite 2 x ActionScript Language Reference...
Page 22: ...22 Contents...
Page 244: ...244 ActionScript language elements...
Page 760: ...760 ActionScript classes...