Alert提示框备用
来源:互联网 发布:淘宝失效宝贝 编辑:程序博客网 时间:2024/04/30 06:13
http://blog.csdn.net/Jerry_BJ/archive/2010/06/06/5650683.aspx
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Style>
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;
}
</mx:Style>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
private var alert:Alert;
[Embed(source="1.png")]
private var BulletCritical:Class;
[Embed(source="1.png")]
private var IconCritical:Class;
private function init():void {
var myMessage:String = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit./nDonec tincidunt sollicitudin sem.";
var myTitle:String = "The quick brown fox jumped over the lazy dog";
// alert = Alert.show(myMessage, myTitle);
/**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 = "取消";
}
]]>
</mx:Script>
<mx:Sequence id="myEffect">
<mx:Parallel>
<mx:Zoom />
<mx:Fade />
</mx:Parallel>
<mx:Rotate />
</mx:Sequence>
<mx:Button label="Launch alert" click="init();" />
</mx:Application>
--------------------------------------------------------------------------------------
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,closeHandler: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);
}
}
}
------------------------------------------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.events.CloseEvent;
private function alt():void{
AlertUtil.Confirm("hello",this,aa);
// AlertUtil.Prompt("aaaaa",this);
}
private function aa(event:CloseEvent):void{
}
]]>
</mx:Script>
<mx:Button label="点击" click="alt()" />
</mx:Application>
--------------------------------------------------------------------
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white"
- creationComplete="showAlert()"
- applicationComplete="init()">
- <!-- Used by the ApplicationControlBar control. -->
- <mx:String id="fileName" />
- <mx:String id="fileSize" />
- <!-- Used by the Alert control. -->
- <mx:String id="message">The quick brown fox jumped over the lazy dog.
- The quick brown fox jumped over the lazy dog.</mx:String>
- <mx:String id="title">The quick brown fox jumped over the lazy dog?</mx:String>
- <mx:Script>
- <![CDATA[
- import mx.controls.Alert;
- private var a:Alert;
- private function init():void {
- var appInfo:LoaderInfo = Application.application.loaderInfo;
- /* Just grab the filename from the SWF URL. */
- fileName = (appInfo.url).split("/").pop();
- /* Convert bytes to kilobytes. */
- fileSize = (appInfo.bytesTotal / 1024).toFixed(2);
- }
- private function showAlert():void {
- Alert.yesLabel = "Accept";
- Alert.noLabel = "Reject";
- Alert.buttonWidth = 120;
- a = Alert.show(
- message,
- title,
- Alert.NO | Alert.YES
- );
- /* Make the Alert form's text non-selectable. */
- a.mx_internal::alertForm.mx_internal::textField.selectable = false;
- }
- ]]>
- </mx:Script>
- <mx:Style>
- @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);
- }
- </mx:Style>
- <!-- Display SWF name and file size. -->
- <mx:ApplicationControlBar id="applicationControlBar" dock="true">
- <mx:Label id="info" text="{fileName} ({fileSize}kb)" />
- </mx:ApplicationControlBar>
- <!-- Click to launch Alert control. -->
- <mx:Button label="Launch Alert" click="showAlert()" />
- </mx:Application>
- Alert提示框备用
- Alert 弹出提示框
- alert提示框
- 自定义alert提示框
- Flex消息提示框Alert
- javascript自制alert提示框
- 仿alert,confirm的信息提示框
- servlet中alert框不提示
- Struts2 返回带alert的提示框
- 简单的自定义提示框(alert)
- java的alert信息提示框
- iOS&OS X -- Alert 提示框实现
- 重写alert,confirm 提示框样式
- bootstrap alert提示框的bug
- JavaScript消息提示框alert和confirm
- jquery alert提示框自动消失
- easyUI实现(alert)提示框自动关闭
- AJAX消息提示-Alert
- 项目日志二
- 懂是为了更好的欣赏
- 编译 源文件奇怪的问题
- 详细分析 动态更新水晶报表(一个dataset多张表)
- 详细分析 动态更新水晶报表(一个dataset多张表)
- Alert提示框备用
- useage of gcc
- linux 链表实例应用程序
- C语言中结构体 自引用 和 相互引用
- 难道fcntl记录锁失效?
- 宇宙的基本法则
- centos 安装tripwire
- 忽然回味C经历
- CentOS yum 升级PHP 5.2.x