[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 ...
随机推荐
- 二十四种设计模式:状态模式(State Pattern)
状态模式(State Pattern) 介绍允许一个对象在其内部状态改变时改变它的行为.对象看起来似乎修改了它所属的类. 示例有一个Message实体类,对它的操作有Insert()和Get()方法, ...
- OpenJudge就算概论-最长单词2【寻找句子内部最长的单词】
/*===================================== 最长单词2 总时间限制: 1000ms 内存限制: 65536kB 描述 一个以'.'结尾的简单英文句子,单词之间用空格 ...
- 【转】PHP 之 CURL 模拟登陆并获取数据
1.CURL模拟登陆的流程和步骤2.tempnam 创建一个临时文件3.使用CURL模拟登陆到PHP100论坛 <?php$cookie_file = tempnam('./temp','coo ...
- zookeeper源码学习一——zookeeper启动
最近正在研究zookeeper,一些心得记录一下,如有错误,还请大神指正. zookeeper下载地址:http://zookeeper.apache.org/releases.html,百度一下就能 ...
- Java 开发环境搭建
找到一篇很不錯的Java開發環境搭建的博客, 原文地址為:http://www.cnblogs.com/bribe/p/3377008.html Java 开发环境搭建 一.开发工具获取 1.开发工具 ...
- [mybatis] mybatis错误:Invalid bound statement (not found)
点击菜单抛出异常: org.springframework.web.util.NestedServletException: Request processing failed; nested exc ...
- rsync配置中的auth error,一个隐秘的错误
我们都知道rsync是linux自带的功能强大的文件同步协议. 为了做免密码文件同步,所以,有多种配置.但是种种配置中,可能会遇到一个让人很纠结的问题,那就是安全认证错误的问题! 这个配置,是基于rs ...
- [Hibernate] - Study test project
最近玩Hibernate的测试代码工程: http://files.cnblogs.com/HD/TestHibernate.7z
- SqlDataAdapter怎么处理事务呢
SqlDataAdapter怎么处理事务呢,没找到相关代码,哪位朋友能提供下 解决方案 » this._DBAdpt-------------SqlDataAdapterthis._DBConn- ...
- [转]UOS 中的虚拟网络设备
随着网络技术,虚拟化技术的发展,越来越多的高级网络设备被加入了到了 Linux 中,这些设备在 UOS 中起到了广泛而关键的作用,包括 Open vSwitch.TAP 设备.Veth 设备等等,梳理 ...