EasyManua.ls Logo

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE - Boolean Function

MACROMEDIA FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
1378 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Global Functions 47
Parameters
function:String - An identifier for a function.
parameter:String - A string that is passed to the function named in the function
parameter.
Example
In the following example, the
playMP3() function is defined. The TextField object list_txt is
created and set so HTML text can be rendered. The text Track 1 and Track 2 are links inside
the text field. The
playMP3() function is called when the user clicks either link and plays the
MP3 that is passed as a parameter of the asfunction call.
var myMP3:Sound = new Sound();
function playMP3(mp3:String) {
myMP3.loadSound(mp3, true);
myMP3.onLoad = function(success) {
if (!success) {
// code to handle errors here
}
};
}
this.createTextField("list_txt", this.getNextHighestDepth(), 0, 0, 200,
100);
list_txt.autoSize = true;
list_txt.html = true;
list_txt.multiline = true;
list_txt.htmlText = "<a href=\"asfunction:playMP3, track1.mp3\">Track 1</
a><br>";
list_txt.htmlText += "<a href=\"asfunction:playMP3, track2.mp3\">Track 2</
a><br>";
When you click a link, the MP3 sound file streams in Flash Player.
See also
htmlText (TextField.htmlText property)
Boolean function
Boolean(expression:Object) : Boolean
Converts the expression parameter to a Boolean value and returns a value as described in the
following list:
If expression is a Boolean value, the return value is expression.
If expression is a number, the return value is true if the number is not 0; otherwise the
return value is
false.

Table of Contents

Related product manuals