[Flex] PopUpButton系列 —— 判断下拉列表是否选中
<?xml version="1.0" encoding="utf-8"?>
<!--Flex中如何利用dataDescriptor属性和isToggled()函数判断PopUpButton的下拉选项是否选中的例子PopUpButtonSelectableOptions.mxml-->
<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.controls.Menu;
import mx.events.FlexEvent;
import mx.events.MenuEvent;
private var _menu:Menu; protected function popUpButton_initializeHandler(event:FlexEvent):void
{
_menu = new Menu();
_menu.variableRowHeight = true;
_menu.dataProvider = arr;
_menu.addEventListener(MenuEvent.CHANGE,onMenuChange);
popUpButton.popUp = _menu;
} protected function onMenuChange(event:MenuEvent):void
{
switch(_menu.dataDescriptor.getType(event.item)){
case "check":
if(_menu.dataDescriptor.isToggled(event.item)){
this.styleName = "redModal";
Alert.show("\""+event.item.label+"\"was checked");
}else{
Alert.show("\""+event.item.label+"\"was not checked");
this.styleName = "greenModal";
}
break;
}
} ]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<fx:Array id="arr">
<fx:Object label="Option 1" type="check" toggled="true" />
<fx:Object label="Option 2" type="check" toggled="true" />
</fx:Array>
</fx:Declarations>
<fx:Style>
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
mx|PopUpButton {
popUpStyleName: MyCustomPopUpStyleName;
} .MyCustomPopUpStyleName {
fontWeight: normal;
textAlign: left;
} .redModal {
modalTransparencyColor: red;
modalTransparency: 0.8;
} .greenModal {
modalTransparencyColor: haloGreen;
modalTransparency: 0.8;
} </fx:Style>
<mx:PopUpButton id="popUpButton" label="Click to open..." openAlways="true" initialize="popUpButton_initializeHandler(event)" />
</s:Application>
[Flex] PopUpButton系列 —— 判断下拉列表是否选中的更多相关文章
- [Flex] PopUpButton系列 —— 弹出菜单的行高设置
<?xml version="1.0" encoding="utf-8"?> <!--Flex中如何通过variableRowHeight样式 ...
- [Flex] PopUpButton系列 —— 控制弹出菜单的透明度、可用、可选择状态
<?xml version="1.0" encoding="utf-8"?><!--控制弹出菜单的透明度.可用.可选择状态 PopUpButt ...
- [Flex] PopUpButton系列 —— 设置弹出菜单与主按钮之间的间隔
<?xml version="1.0" encoding="utf-8"?><!--设置弹出菜单与主按钮之间的间隔 PopUpButtonPo ...
- [Flex] PopUpButton系列 —— 打开和关闭弹出菜单
<?xml version="1.0" encoding="utf-8"?><!--响应打开和关闭弹出菜单的例子 PopUpButtonOpe ...
- [Flex] PopUpButton系列 —— 添加按钮图标
<?xml version="1.0" encoding="utf-8"?><!--为主按钮添加默认图标 PopUpButtonIcon.mx ...
- [Flex] PopUpButton系列 —— 将DataGrid作为弹出内容
<?xml version="1.0" encoding="utf-8"?> <!--Flex中如何创建一个可以弹出DataGrid作为菜单的 ...
- [Flex] PopUpButton系列——CornerRadius的运用
<?xml version="1.0" encoding="utf-8"?><!--设置主按钮圆角半径 PopUpButtonCornerRa ...
- jquery复选框 选中事件 及其判断是否被选中
jquery复选框 选中事件 及其判断是否被选中 (2014-07-25 14:03:54) 转载▼ 标签: jquery复选框选中事件 分类: extjs jquery 今天做了 显示和不显示密 ...
- ----------jqery和js如何判断checkbox是否选中 --------两个单选按钮如何选一个,且用jquery获取被选的值
jqery和js如何判断checkbox是否选中 jquery: <div id="divId" class="divTable"> <div ...
随机推荐
- IIS调用COM组件的权限问题
在DCOM组件服务中给MICROSOFT.EXCEL组件 赋予ASP.NET的操作权限,具体步骤: (1)打开开始菜单的运行对话框,输入dcomcnfg命令,确定,这时会弹出组件服务窗口 (2)展开计 ...
- ASP.NET会话(Session)保存模式--终于知道session为什么丢失了
[原创]ASP.NET会话(Session)保存模式 作者:寒羽枫(cityhunter172) 大家好,已有四个多月没写东东啦.今日抽空就说一下 Session 在 .Net v1.0/v1.1 中 ...
- unity, LoadLevelAdditive到帧末才完成
Application.LoadLevelAdditive文档中说: LoadLevel and LoadLevelAdditive don't happen immediately - a new ...
- wikioi1012 最大公约数和最小公倍数问题(2001年NOIP全国联赛普及组)
题目描述 Description 输入二个正整数x0,y0(2<=x0<100000,2<=y0<=1000000),求出满足下列条件的P,Q的个数 条件: 1.P,Q是正整 ...
- SQL Server取系统当前时间【转】
getdate //获得系统当前日期 datepart //获取日期指定部分(年月日时分表) getdate()函数:取得系统当前的日期和时间.返回值为datetime类型的. 用法:getdate( ...
- Linux-remote change password (more)
1.creat managment Certification on Mangar Serverssh-keygen -t rsa2.creat client Certification on Cli ...
- Jquary获取页面控件的值
一 Jquery获得服务器控件值的方法由于ASP.NET网页运行后,服务器控件会随机生成客户端id,jquery获取时候不太好操作,google了下,总结有以下3种方法: 服务器控件代码:<as ...
- ExtJs学习之Window
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <m ...
- 阿里云nat mysql配置
# Generated by iptables-save v1. :: *filter :INPUT DROP [:] :FORWARD ACCEPT [:] :OUTPUT ACCEPT [:] # ...
- MyEclipse配置Resin启动报错问题
错误信息如下: com.caucho.config.ConfigException: -server 'default' is an unknown server in the configurati ...