dedecms织梦内容管理系统    
首页 | java | C/C++ | PHP | 操作系统 | ajax | 脚本编程 | 安全技术 | 本站下载页 | flex | CRM | 专题 | QQ群 | 测试中心 | 会员中心 | 积分规则
  当前位置:主页>flex>文章内容
flex确认提示(confirm window)
来源: 作者:admin

    在javascript中,有个confirm的提示框,actionscript可以改变Alert.show();的参数实现这个功能。代码如下

<?xml version=”1.0″ encoding=”utf-8″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml” layout=”absolute” backgroundGradientColors=”[#ffffff, #c0c0c0]”>

<mx:Script>
<![CDATA[
import mx.events.FlexEvent;
import mx.effects.Fade;
import mx.controls.Alert;
import mx.events.CloseEvent;

[Embed(source=’assets/exclamation.png’)]
private var confirmIcon:Class;

private function confirm():void {
// instantiate the Alert box
var a:Alert = Alert.show(”Are you sure you want to\nperform that action?”, “Confirmation”, Alert.YES|Alert.NO, this, confirmHandler, confirmIcon, Alert.NO);
//
第一个参数是要显示的文本,第二个参数是窗口的标题,第三个参数是按纽,第四个参数是父窗体,第五个参数是关闭后要执行的动作函数,第六个参数是图标,第七个参数是默认的按纽

// modify the look of the Alert box
a.setStyle(”backgroundColor”, 0xffffff);
a.setStyle(”backgroundAlpha”, 0.50);
a.setStyle(”borderColor”, 0xffffff);
a.setStyle(”borderAlpha”, 0.75);
a.setStyle(”color”, 0×000000); // text color
}

private function confirmHandler(event:CloseEvent):void {
if (event.detail == Alert.YES) {
// what to do if user selected “yes”
result.text = “Yes”;
} else if (event.detail == Alert.NO) {
// what to do if user selected “no”
result.text = “No”;
}
}
]]>
</mx:Script>

<mx:Button x=”10″ y=”45″ label=”Confirm” click=”confirm();”/>
<mx:Label x=”10″ y=”19″ text=”Result:”/>
<mx:Label x=”63″ y=”19″ fontWeight=”bold” id=”result”/>
</mx:Application>


上一篇:利用VC编程在界面上实现3D文字   下一篇:Perl/TkFAQ如何使用某个组件来完成某个工作
[收藏] [推荐] [评论(0条)] [返回顶部] [打印本页] [关闭窗口]  
用户名: 新注册) 密码: 匿名评论
评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
 §最新评论
  热点文章
·Flex 打印DataGrid内容
·Flex中的闪烁效果
·flex: 使用setInterval 制作定时
·FLEX优秀开源项目介绍
·AS3中的正则表达式
·Flex RemoteObject类参考
·flex:RemoteObject 和 DataGrid
·AS3的面向对象特点概述
·利用AS3的图形界面开发及资源管
·AS3.0 访问属性
·AS3.0强大的事件机制
·FLASH CS3/AS3.0教程汇总(2007-7
  相关文章
·Flex RemoteObject类参考
·flex:RemoteObject 和 DataGrid
·AS3的面向对象特点概述
·利用AS3的图形界面开发及资源管
·AS3.0 访问属性
·AS3.0强大的事件机制
·FLASH CS3/AS3.0教程汇总(2007-7
·一个flex正则表达式的例子
·AS3中使用的正则表达式
·flex文件上传
·flex文件下载
·定义Flex程序进度条
  相关信息
copy right @ 百家拳软件项目研究室 2007 辽ICP备07011763