<?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系列 —— 判断下拉列表是否选中的更多相关文章

  1. [Flex] PopUpButton系列 —— 弹出菜单的行高设置

    <?xml version="1.0" encoding="utf-8"?> <!--Flex中如何通过variableRowHeight样式 ...

  2. [Flex] PopUpButton系列 —— 控制弹出菜单的透明度、可用、可选择状态

    <?xml version="1.0" encoding="utf-8"?><!--控制弹出菜单的透明度.可用.可选择状态 PopUpButt ...

  3. [Flex] PopUpButton系列 —— 设置弹出菜单与主按钮之间的间隔

    <?xml version="1.0" encoding="utf-8"?><!--设置弹出菜单与主按钮之间的间隔 PopUpButtonPo ...

  4. [Flex] PopUpButton系列 —— 打开和关闭弹出菜单

    <?xml version="1.0" encoding="utf-8"?><!--响应打开和关闭弹出菜单的例子 PopUpButtonOpe ...

  5. [Flex] PopUpButton系列 —— 添加按钮图标

    <?xml version="1.0" encoding="utf-8"?><!--为主按钮添加默认图标 PopUpButtonIcon.mx ...

  6. [Flex] PopUpButton系列 —— 将DataGrid作为弹出内容

    <?xml version="1.0" encoding="utf-8"?> <!--Flex中如何创建一个可以弹出DataGrid作为菜单的 ...

  7. [Flex] PopUpButton系列——CornerRadius的运用

    <?xml version="1.0" encoding="utf-8"?><!--设置主按钮圆角半径 PopUpButtonCornerRa ...

  8. jquery复选框 选中事件 及其判断是否被选中

    jquery复选框 选中事件 及其判断是否被选中 (2014-07-25 14:03:54) 转载▼ 标签: jquery复选框选中事件 分类: extjs jquery   今天做了 显示和不显示密 ...

  9. ----------jqery和js如何判断checkbox是否选中 --------两个单选按钮如何选一个,且用jquery获取被选的值

    jqery和js如何判断checkbox是否选中 jquery: <div id="divId" class="divTable"> <div ...

随机推荐

  1. debug,trace,release项目配置区别

    Debug模式是用来调试用的,它生成的执行文件中含有大量调试信息,所以很大: Release模式生成的执行文件消除了这些调试信息,可用来作为成品发布 Debug只在debug状态下会输出,Trace在 ...

  2. linux包之gdb之gdb命令与core文件产生

    gdb-7.2-64.el6_5.2.x86_64/usr/bin/gcore/usr/bin/gdb/usr/bin/gdb-add-index/usr/bin/gdbtui/usr/bin/gst ...

  3. HtmlEncode、HtmlDecode、UrlEncode、UrlDecode

    HtmlEncode: 将 Html 源文件中不允许出现的字符进行编码.例如:"<".">"."&" 等. HtmlDe ...

  4. Google Proposes to Enhance JSON with Jsonnet

    Google has open sourced Jsonnet, a configuration language that supersedes JSON and adds new features ...

  5. Send an email with format which is stored in a word document

    1. Add a dll reference: Microsoft.Office.Interop.Word.dll 2. Add the following usings using Word = M ...

  6. 图片上传,图片剪切jquery.imgareaselect

    ---恢复内容开始--- <%@ page language="java" contentType="text/html; charset=UTF-8" ...

  7. azure 云上MySQL最新版本 MySQL5.7.11 批量自动化一键式安装 (转)

    --背景云端 以前都喜欢了源码安装mysql,总觉得源码是高大上的事情,不过源码也需要时间,特别是make的时候,如果磁盘和cpu差的话,时间很长很长,在虚拟机上安装mysql尤其甚慢了. 现在业务发 ...

  8. [oracle] ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener

    安装好Oracle数据库后: 执行 dbstart和dbshut会提示: [oracle@oracle11g ~]$ dbstartORACLE_HOME_LISTNER is not SET, un ...

  9. MS CRM 2011的自定义和开发(11)——插件(plugin)开发(三)

    http://www.cnblogs.com/StoneGarden/archive/2012/02/06/2340661.html MS CRM 2011的自定义和开发(11)——插件(plugin ...

  10. RDO部署openstack(1)

    1. 安装系统CentOS 6.5   2. 网络配置   Eth0 设置 # cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 ON ...