| Using
asfunction in an UIComponent like TextArea
The asfunction protocol allows you to
call Flash commands from hyperlinks in your TextFields.
To call a function in the same timeline as your TextField you would
usually use something like:
myTxtFld.htmlText = "<a href='asfunction:myFunction,foo'><u><font
color='#000099'>link</font></u></a>";
function myFunction(p)
{
trace(p);
}
See Macromedia
Actionscript Dictionary
However, if you use a TextArea in the same timeline using the following
won't work:
myTxtArea.text = "<a href='asfunction:myFunction,foo'><u><font
color='#000099'>link</font></u></a>";
The reason for this is that the function is expected in the same
timeline as the TextField. Within the TextArea component, however,
the TextField used to display the text is a child of the component
timeline. The timeline that contains your function is actually the
_parent timeline of the one containing
the TextField.
So use the following to get it to work:
myTxtArea.text = "<a href='asfunction:_parent.myFunction,foo'><u><font
color='#000099'>link</font></u></a>";
|