Flex 超链接跳转
发布时间:2020-12-15 05:04:46 所属栏目:百科 来源:网络整理
导读:?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:
<?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> <!-- 将非可视元素(例如服务、值对象)放在此处 --> </fx:Declarations> <fx:Script> <![CDATA[ import flash.net.navigateToURL; import mx.controls.Alert; import mx.core.mx_internal; private function initApp():void{ var str:String = "<a href='http://www.baidu.com' target='_blank'>文本超链接</a>"; link.htmlText = str; } private function handleHTMLTextAlertClick():void { var link:String = "http://javacrazyer.iteye.com/" var text:String="<u><a href='"+link+"' target='_blank'> 转到百度</a></u>"; var a:Alert = Alert.show(text,"message"); //关键就是下面这句话了,保证了对HTML标签的支持 a.mx_internal::alertForm.mx_internal::textField.htmlText = text; } private function openUrl():void{ navigateToURL(new URLRequest("http://www.baidu.com"),"_blank"); } ]]> </fx:Script> <mx:Button x="25" y="28" label="按钮超级链接" fontSize="13" id="link2" click="openUrl()"/> <mx:Button label="彈出框超链接" click="handleHTMLTextAlertClick()" x="25" y="76"/> <mx:Text id="link" text="文本超链接" x="25" y="137" fontSize="13"/> </s:Application> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |