Alert {
/**通过buttonStyleName样式自定义Alert显示的按钮风格**/
buttonStyleName: myCustomButtonStyleName;
/**通过messageStyleName样式自定义Alert显示内容风格 **/
messageStyleName: myCustomMessageStyleName;
/**通过titleStyleName样式自定义Alert显示标题**/
titleStyleName: myCustomTitleStyleName;
/**通过backgroundAlpha, backgroundColor, borderAlpha和borderColor样式给Alert对话框设置背景颜色 **/
backgroundAlpha: 0.3;
backgroundColor: red;
borderAlpha: 0.3;
borderColor: red;
dropShadowEnabled: false;
creationCompleteEffect: myEffect;
}
.myCustomButtonStyleName {
color: red;
cornerRadius: 12;
fontFamily: myComicSansMS;
fontSize: 10;
fontWeight: normal;
textDecoration: underline;
themeColor: red;
}
.myCustomMessageStyleName {
color: haloOrange;
fontFamily: myComicSansMS;
fontSize: 10;
fontWeight: normal;
}
.myCustomTitleStyleName {
color: haloOrange;
fontFamily: myComicSansMS;
fontSize: 16;
fontWeight: normal;
}
Flex中如何利用titleIcon和iconClass属性给Alert添加Icon图标的例子 **/
alert = Alert.show(myMessage, myTitle, Alert.YES|Alert.NO, null, null, IconCritical);
alert.titleIcon = BulletCritical;
//改变默认可选按钮的显示标签和按钮宽度。
// Alert.buttonWidth = 100;
// Alert.yesLabel = "确定";
// Alert.noLabel = "否";
// Alert.cancelLabel = "取消";
}
]]>
-------------------------------------------------- ------------------------------------
package
{
import flash.display.DisplayObject;
import mx.controls.Alert;
import mx.managers.PopUpManager;
import flash.events.Event;
public class AlertUtil
{
public function AlertUtil()
{
}
public static function Prompt(msg:String,parent:DisplayObject):void{
var alert:Alert = new Alert();
alert.setStyle("messageStyleName","AlertMessage");
alert.setStyle("titleStyleName","AlertTitle");
alert.title = "提示";
alert.text = msg;
PopUpManager.addPopUp(alert,parent,true);
PopUpManager.centerPopUp(alert);
}
public static function Confirm(msg:String,parent:DisplayObject,closeHandl er:Function){
var alert:Alert = new Alert();
alert.setStyle("messageStyleName","AlertMessage");
alert.setStyle("titleStyleName","AlertTitle");
alert.title = "操作确认";
alert.text = msg;
alert.addEventListener(Event.CLOSE,closeHandler);
alert.buttonFlags = Alert.OK | Alert.CANCEL;
alert.defaultButtonFlag = Alert.OK;
PopUpManager.addPopUp(alert,parent,true);
PopUpManager.centerPopUp(alert);
}
}
}
-------------------------------------------------- ----------------------------
-------------------------------------------------- ------------------
The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog.
The quick brown fox jumped over the lazy dog?
@font-face{
src: url("./fonts/base02.ttf");
fontFamily: "Base02";
}
Alert {
titleStyleName: "alertTitle";
messageStyleName: "alertMessage";
buttonStyleName: "alertButton";
dropShadowEnabled: true;
shadowDistance: 5;
shadowDirection: right;
cornerRadius: 0;
embedFonts: true;
fontFamily: Base02;
}
.alertTitle {
letterSpacing: 0;
fontSize: 14;
color: red;
}
.alertMessage {
letterSpacing: 0;
fontSize: 10;
fontWeight: normal;
color: black;
}
.alertButton {
letterSpacing: 0;
fontSize: 11;
cornerRadius: 10;
fontWeight: normal;
textRollOverColor: white;
color: red;
skin: ClassReference(null);
}