Using asfunction to Call a ActionScript Function
In HTML text fields on flash movie, text may be hyperlinked using the HTML A tag with HREF attribute contains a URL that may be for a standard protocol like HTTP. For example <A HREF=”http://zawa.blogsome.com”>test</A>. The asfunction protocol is an additional protocol specific to Flash which causes the link to invoke an ActionScript function. You can use this protocol to call your ActionScript function on flash movie.
In this example, the Hello() function is defined in the first three lines of code. The TextField object myTextField is associated with an HTML text field. The text “Test” is a hyperlink inside the text field. The Hello() function is called when the user clicks on the hyperlink.
myTextField.htmlText ="<A HREF="asfunction:Hello,Zawa ">Test</A>";
function Hello(name){
trace ("Hello "+name);
}
When the hyperlink is clicked, the following results are written to the log file:
Hello Zawa








