Return to Kroll Design home page

Flash Tutorials (with .FLA files included)

 
« Return

ActionScript 3

Using text events

When inserting HTML into a text field, the link can either link to a web site, or trigger an event within the Flash movie. This example triggers an event instead of going to a web site.

Download the FLA file

var abc:TextField = new TextField();
abc.width = 150;
abc.height = 50;
abc.x = 30;
abc.y = 30;
abc.htmlText = "<a href='event:this is the event text'>Click here</a>";
abc.addEventListener(TextEvent.LINK, clickFunc);
var xyz:TextField = new TextField();
xyz.width = 150;
xyz.height = 50;
xyz.x = 220;
xyz.y = 30;
function clickFunc(myEvent:TextEvent)
{
	abc.htmlText = "Click was successful";
	xyz.text = myEvent.text;
}
addChild(abc);
addChild(xyz);


 
« Return


©2012 Kroll Design    info@KrollDesign.net    781.910.3694
Last modified: 12/31/1969 7:00 PM