flex超链接

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
               xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
               creationComplete="initApp()" >
    <fx:Declarations>
        <!-- Place non-visual elements (e.g., services, value objects) here -->
    </fx:Declarations>
    
    <fx:Script>
        <![CDATA[
            //'_self'代表在本窗口中打开;'_blank'代表在后台新窗口中打开
            private function initApp():void{  
                var str:String = "<a target='_blank' href='http://www.baidu.com/'>Link超链接</a>";  
                link.htmlText = str;  
            }  
            
            private function openUrl():void{  
                navigateToURL(new URLRequest("http://www.baidu.com/"), "_blank");  
            }
        ]]>
    </fx:Script>
    
    <mx:Button x="72" y="117" label="Button链接" fontSize="13" id="link2" click="openUrl()"/>  
    
    <mx:Text id="link" text="xcopy" x="72" y="47" fontSize="13"/>
    
<!--
    另外一个例子:
    <mx:LinkButton label="***" click="openUrl()" fontSize="12" fontWeight="normal"/>
    internal function openUrlSecond():void{  
    navigateToURL(new URLRequest("news.html"), '_self');  
    }
    -->
</s:Application>
                 

 

posted @ 2013-09-24 18:04  High阔天空  阅读(297)  评论(0)    收藏  举报