<?xml version="1.0" encoding="utf-8"?>
<!---
Text.styleSheet Sample
-->
<mx:Application
    xmlns:mx        = "http://www.adobe.com/2006/mxml"
    layout          = "vertical"
    backgroundAlpha = "1"
    backgroundColor = "#ffffff"
 viewSourceURL="srcview/index.html">
    <mx:Script>
        <![CDATA[
            import flash.utils.getTimer;
            protected override function createChildren():void {
                super.createChildren();

                var styles:StyleSheet = new StyleSheet();
                styles.setStyle(".test",   { color : "#333333", fontSize : "30" });
                styles.setStyle("a:link",  { color : "#000099" });
                styles.setStyle("a:hover", { color : "#9999cc", textDecoration : "underline" });

                //Flex SDK 3.4 以降で使用可能
                targetText.styleSheet = styles;

                targetText.htmlText = "<p class='test'>My site is <a href='event:HOGE'>http://taiga.jp/</a> !!</p>";
                targetText.addEventListener(TextEvent.LINK, debugTextLinkHandler);
            }
            protected function debugTextLinkHandler(event:TextEvent):void {
                debugText.text += event.toString() + " : " + getTimer().toString() +"\n";
            }
        ]]>
    </mx:Script>
    <mx:Text id="targetText" />
    <mx:TextArea id="debugText" editable="false" fontSize="20" width="100%" height="100%" />
</mx:Application>