闲话不说,贴上代码
<?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">
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.core.mx_internal;
use namespace mx_internal;
private function handleRegularAlertClick():void
{
var link:String = "http://www.favzone.com"
var text:String = "请访问后方网址: " + link;
Alert.show( text );
}
private function handleHTMLTextAlertClick():void
{
var link:String = "http://javacrazyer.iteye.com/"
var text:String = "请访问后方超链接, <u><a href='" + link + "' target='_blank'>click here </a></u>" ;
var a:Alert = Alert.show(text);
//关键就是下面这句话了,保证了对HTML标签的支持
a.mx_internal::alertForm.mx_internal::textField.htmlText = text;
}
]]>
</fx:Script>
<mx:HBox>
<mx:Button
label="普通提示"
click="handleRegularAlertClick()"
/>
<mx:Label
text="显示普通的提示,只能复制网址来访问"
/>
</mx:HBox>
<mx:HBox>
</mx:HBox>
<mx:Button
label="超链接提示"
click="handleHTMLTextAlertClick()"
x="10" y="135"/>
<mx:Label
text="显示超链接的提示,点击能链接到一个新的网页"
x="96" y="136"/>
</s:Application>