is supported in part by

July 24, 2003

reader mail: call function from link in html text field

josh writes:
Imagine a string of htmlText, let's have it say "Click here to jump around." Now, on the word “here” there needs to be an anchor tag that…wait for it…runs a piece of Actionscript that's within the same .swf. Perhaps a simple function that just launches a trace message. I've tried everything I can think of and this is such a specific topic it's difficult to find information on it. Do you have any ideas on the topic?

colin answers:
hey josh,
it goes a little something like this:

this.createTextField("tf", 0, 100, 100, 200, 20);
tf.html = true;
tf.htmlText = "Click <A HREF='asfunction:displayMsg,hello world'>here</A> to jump around";

function displayMsg (msg) {

more info on page 1001 of your copy of asdg2. (it's actually listed in the index under "hypertext links, calling ActionScript functions from).

Posted by moock at July 24, 2003 10:43 PM