flash on 2010-1-2

by foo9
♥0 | Line 28 | Modified 2010-01-02 17:02:47 | MIT License
play

ActionScript3 source code

/**
 * Copyright foo9 ( http://wonderfl.net/user/foo9 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/vnYR
 */

package
{
    import flash.display.Sprite;
    import flash.events.TextEvent;
    import flash.text.TextField;
    
    public class FlashTest extends Sprite 
    {
    		public static const HOGE_TEXT:String = "<a href='event:hogehoge'>please click here.</a>";
    		private var textField:TextField;
    		
    		public function FlashTest()
    		{
            textField = new TextField();
            addChild(textField);
            textField.htmlText = HOGE_TEXT;
            textField.x = 10;
            textField.y = 10;
            textField.width = textField.textWidth + 5;
            textField.height = textField.textHeight + 5; 
            textField.background = true;
            textField.backgroundColor = 0xCCCCCC;
            textField.addEventListener(TextEvent.LINK, linkHandler);
    		}
    		
    		private function linkHandler(event:TextEvent):void
    		{
    			textField.htmlText = "<b>" + event.text + "</b>";
    		}
    }
}