[Flex] PopUpButton系列 —— 打开和关闭弹出菜单
<?xml version="1.0" encoding="utf-8"?>
<!--响应打开和关闭弹出菜单的例子 PopUpButtonOpenAndClose.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">
<s:layout>
<s:VerticalLayout/>
</s:layout> <fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.controls.Menu;
import mx.events.DropdownEvent;
import mx.events.ListEvent; import spark.events.GridEvent;
[Bindable]
private var menu:Menu; private function init():void {
menu = new Menu();
menu.dataProvider = arr;
} private function popUpButton_open(evt:DropdownEvent):void {
arrColl.addItem(evt);
} private function popUpButton_close(evt:DropdownEvent):void {
arrColl.addItem(evt);
trace(evt.toString());
} protected function dataGrid_gridClickHandler(event:GridEvent):void
{
var obj:DropdownEvent = event.currentTarget.selectedItem;
if(!obj) return;
var str:String = "(empty string)";
if (obj.triggerEvent) {
str = obj.triggerEvent.toString();
}
Alert.show(str, "triggerEvent:");
} ]]>
</fx:Script>
<fx:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<fx:Array id="arr">
<fx:Object label="Button" />
<fx:Object label="ButtonBar" />
<fx:Object label="ColorPicker" />
<fx:Object label="ComboBox" />
</fx:Array>
<s:ArrayCollection id="arrColl"/>
</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;
} </fx:Style>
<s:controlBarContent>
<mx:PopUpButton id="popUpButton"
label="Select a control..."
popUp="{menu}"
initialize="init();"
open="popUpButton_open(event);"
close="popUpButton_close(event);" />
</s:controlBarContent>
<s:DataGrid id="dataGrid" dataProvider="{arrColl}" variableRowHeight="true" width="500" height="400" gridClick="dataGrid_gridClickHandler(event)" >
<s:columns>
<s:ArrayList>
<s:GridColumn dataField="type" width="100" />
<s:GridColumn dataField="triggerEvent" />
</s:ArrayList>
</s:columns>
</s:DataGrid>
<!--<mx:DataGrid id="dataGrid" dataProvider="{arrColl}" variableRowHeight="true" width="100%" height="100%" itemClick="dataGrid_itemClickHandler(event)">
<mx:columns>
<mx:DataGridColumn dataField="type" width="100"/>
<mx:DataGridColumn dataField="triggerEvent" itemRenderer="mx.controls.Label"/>
</mx:columns>
</mx:DataGrid>-->
</s:Application>
[Flex] PopUpButton系列 —— 打开和关闭弹出菜单的更多相关文章
- [Flex] PopUpButton系列 —— 将DataGrid作为弹出内容
<?xml version="1.0" encoding="utf-8"?> <!--Flex中如何创建一个可以弹出DataGrid作为菜单的 ...
- jq点击按钮打开和关闭弹出层,点击除了当前按钮以外的地方关闭弹出层
1.html <a id="more" onclick="moreFun()">更多</a> <ul id="moreL ...
- Mui --- 弹出菜单
mui框架内置了弹出菜单插件,弹出菜单显示内容不限,但必须包裹在一个含.mui-popover类的div中,如下即为一个弹出菜单内容: <div id="popover" c ...
- 解决Mui中popover 顶部弹出菜单弹出位置不准确以及无法收回的问题
前言 最近公司的项目转向使用Hbuilder开发移动端项目,其中想要通过在顶部标题栏加入弹出菜单的方式,来定位长列表的位置,如图所示. 问题 Mui的功能貌似还不是很完善,在使用这个弹出菜单的时候,发 ...
- [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] 组件Tree系列 —— 作为PopUpButton的弹出菜单
mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:Tree作为PopUpButton ...
- MUI - 打开页面默认弹出键盘及返回关闭键盘
打开页面默认弹出键盘及返回关闭键盘 http://www.cnblogs.com/phillyx/ (function(keyboard) { var openSoftKeyboard = funct ...
随机推荐
- jQuery根据文本设置select选中失效问题
$("#select_id option[text='jQuery']").attr("selected", true) 失效 text是Jquery关键字,不 ...
- uploadify多次加载导致页面无法加载
function upld() { $('#file_upload').uploadify({ 'formData' : {'seccode':'<?php echo get_cookie('a ...
- Kindle 实用技巧
1.Kindle Mate:可以连接kindle导出生词本,笔记,注释,超级棒. 2.把PDF发送到Kindle的时候,邮件主题写convert,这样系统会自动把PDF转换成适合Kindle阅读的格式 ...
- CSS深入之label与input对齐!
我想很多人都会碰到label与input 对齐的问题. 这个东西本身不难,但是要做到与IE这个东西兼容确实有点头疼. 参考各大门户网站的前端源码. 得一方法,以记录之: html确实很简单: 帐号 输 ...
- 解决Centos6.5虚拟机上网问题
起初是为了能通过上网的方式简化g++的安装,故有此篇博文,希望能帮助到有需要的人. 虚拟机环境: 1.Linux系统:Centos6.5 64位 2.ifconfig查看虚拟机ip:竟然没有ip! 3 ...
- 客户端TortoiseSVN的安装及使用方法
一.客户端TortoiseSVN的安装 运行TortoiseSVN程序,点击Next,下面的截图顺序即为安装步骤: 图1: 图2: 图3: 图4: 点击Finish按钮后会提示重启系统,其实不重启也没 ...
- openstack(liberty): 简单网络连接图
openstack起初的网络部分是和计算核心nova合在一起的,后来被拆分出来,独立成为一个模块, 现在名为Neutron. 本博文是学习记录,记录的是基于GRE tunnel技术的neutron和计 ...
- 关于SqlServer的DBHelper类以及数据分页
前端: <My:AspNetPager class="arPage" PageSize="20" UrlPaging="true" r ...
- 程序员书单_J2EE专题
Enterprise JavaBeans 3.0中文版(第5版) http://download.csdn.net/detail/shenzhq1980/9104015 J2EE设计模式 http:/ ...
- nova分析(10)—— nova-rootwrap
一.nova-rootwrap的作用 部署玩过openstack的都应该知道,它会生成一个nova用户来管理所有服务.nova身份在linux中属于普通用户级别,避免了一些需要root身份运行的操作, ...