MACROMEDIA FLEX-FLEX ACTIONSCRIPT LANGUAGE Reference page 682

Actionscript language reference
Table of Contents

Advertisement

Parameters
The identifier of an exported sound in the library. The identifier is located in the
idName
Linkage Properties dialog box.
Returns
Nothing.
Description
Method; attaches the sound specified in the
sound must be in the library of the current SWF file and specified for export in the Linkage
Properties dialog box. You must call
Example
The following example attaches the sound
the linkage identifier
var my_sound:Sound = new Sound();
my_sound.attachSound("logoff_id");
my_sound.start();
Sound.duration
Availability
Flash Player 6.
Usage
my_sound.duration:Number
Description
Read-only property; the duration of a sound, in milliseconds.
Example
The following example loads a sound and writes the duration of the sound file to the log file. Add
the following ActionScript to your FLA or AS file.
var my_sound:Sound = new Sound();
my_sound.onLoad = function(success:Boolean) {
var totalSeconds:Number = this.duration/1000;
trace(this.duration+" ms ("+Math.round(totalSeconds)+" seconds)");
var minutes:Number = Math.floor(totalSeconds/60);
var seconds = Math.floor(totalSeconds)%60;
if (seconds<10) {
seconds = "0"+seconds;
}
trace(minutes+":"+seconds);
};
my_sound.loadSound("song1.mp3", true);
682
Chapter 7: ActionScript for Flash
Sound.start()
logoff_id
.
logoff_id
parameter to the specified Sound object. The
idName
to start playing the sound.
to
my_sound
. A sound in the library has

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLEX-FLEX ACTIONSCRIPT LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flex

Table of Contents