package { import flash.display.MovieClip; import flash.text.TextField; import flash.events.TextEvent; public class TextFildTest extends MovieClip{ public function TextFildTest() { // constructor code var textFiled:TextField = new TextField(); textFiled.name = "_textFiled"; textFiled.htmlText = "<a href=‘event:typetext‘>con</a>"; textFiled.addEventListener(TextEvent.LINK,linkhandle); addChild(textFiled); } private function linkhandle(event:TextEvent):void{ trace(event.type); //link trace(event.text); //typetext trace(event.target.text) ; //con trace(event.target.name); } } }
时间: 2024-11-08 11:37:11