Asfunction - MACROMEDIA FLASH MX 2004-ACTIONSCRIPT LANGUAGE Reference

Actionscript language reference
Table of Contents

Advertisement

asfunction

Availability
Flash Player 5.
Usage
asfunction:function:Function,"parameter":String
Parameters
An identifier for a function.
function
A string that is passed to the function named in the
parameter
Returns
Nothing.
Description
Protocol; a special protocol for URLs in HTML text fields. In HTML text fields, text can be
linked using the HTML
standard protocol such as HTTP, HTTPS, or FTP. The
protocol that is specific to Flash, which causes the link to invoke an ActionScript function.
Example
In the following example, the
created and set so HTML text can be rendered. The text
the text field. 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.
tag. The
A
HREF
playMP3()
function is called when the user clicks either link and plays the
playMP3()
ActionScript Language Reference
attribute of the
tag contains a URL that can be for a
A
asfunction
function is defined. The TextField object
Track 1
CHAPTER 2
parameter.
function
protocol is an additional
list_txt
and
are links inside
Track 2
asfunction
is
125

Advertisement

Table of Contents
loading
Need help?

Need help?

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

Questions and answers

This manual is also suitable for:

Flash mx

Table of Contents