0
我想创建自定义错误并通知消息,但我不知道应该使用哪个元素。在消息中应该有我尝试使用Label的图标和文本,但不知道如何构建我需要的自定义标签。有关于如何创建自定义标签或提示如何做的资源?标签也需要边框和一些效果。如何创建自定义错误并通知消息
我想创建自定义错误并通知消息,但我不知道应该使用哪个元素。在消息中应该有我尝试使用Label的图标和文本,但不知道如何构建我需要的自定义标签。有关于如何创建自定义标签或提示如何做的资源?标签也需要边框和一些效果。如何创建自定义错误并通知消息
您可以使用默认的Alert
弹出并添加一个图标。
从http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/:
<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/07/21/setting-an-icon-in-an-alert-control/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
creationComplete="showAlert();"
backgroundColor="white">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.CloseEvent;
// Embed the error.png image.
[Bindable]
[Embed(source='assets/error.png')]
private var Icon:Class;
private var a:Alert;
private function showAlert():void {
var titleText:String = "WARNING";
var messageText:String = "Are you sure you would like to erase the Internet?\\n\\nPress OK to continue, or Cancel to abort.";
/* Display the Alert, show the OK and Cancel buttons,
and show an icon represented by the Icon binding. */
a = Alert.show(messageText, titleText, Alert.OK | Alert.CANCEL, null, doClose, Icon);
}
private function doClose(evt:CloseEvent):void {
// do nothing.
}
]]>
</mx:Script>
<mx:Button label="Launch Alert" click="showAlert();" />
</mx:Application>
你想自定义错误弹出,或显示在Flash调试版本自定义错误代码? – Daniel 2011-03-06 18:57:40