パネルのstausテキストにリンクを付ける

2055 ワード


<?xml version="1.0" encoding="utf-8"?> 
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" 
        layout="vertical" 
        verticalAlign="middle" 
        backgroundColor="white" 
        creationComplete="init();"> 
  
    <mx:Script> 
        <![CDATA[ 
            import mx.core.IUITextField; 
            import mx.controls.Alert; 
  
            private function init():void { 
                var tf:IUITextField = panel.mx_internal::getStatusTextField(); 
                tf.selectable = true; 
                tf.addEventListener(TextEvent.LINK, textField_link); 
                tf.htmlText = "status with <a href='event:showAlert'><u>link</u></a>"; 
  
            } 
  
            private function textField_link(evt:TextEvent):void { 
                Alert.show("Success! A Panel container with a link in the status text.", evt.text); 
            } 
        ]]> 
    </mx:Script> 
  
    <mx:Panel id="panel" 
            title="Title" 
            status="status with link" 
            width="320" 
            height="240"> 
        <mx:Text text="Click the link in the Panel container's status bar to launch an Alert control." 
                width="100%" selectable="false" /> 
        <mx:ControlBar> 
            <mx:Text htmlText="&lt;b&gt;Note:&lt;/b&gt; The status text field must have it's selectable property set to true in order to dispatch the link event." 
                    width="100%" selectable="false" /> 
        </mx:ControlBar> 
    </mx:Panel> 
  
</mx:Application>