[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 ...
随机推荐
- AR、美颜、机器人:计算机视觉库几乎无所不在
最近日本推出的反美颜应用Primo可能让感到不胜惶恐.其实,这样反人类的应用,你也能写出,不过必须了解的一些技术,就是计算机视觉.目前,计算机视觉库包括FastCV.OpenCV.JavaCV等. 相 ...
- JavaScript 的字符串转换
数字.布尔值等其他数据类型都可以转换成字符串:一般来说,脚本引擎将根据上下文自动完成这样的转换.例如,当把数字或布尔型变量传给希望接收字符串变量的函数时,就会先隐式地将该数值转换成字符串,再进行处理: ...
- 动态进行JQ Validate 的方法
$.validator.unobtrusive.parse($('form[action = "@Url.Action()"]'));
- snort使用
http://jingyan.baidu.com/article/d8072ac45a626fec95cefd85.html 接上篇,如果编译安装snort并指定了prefix,那么须指定一个软链接, ...
- 学习Python遇到的那些坑
1. 初始化一个类,这个方法名必须为”__init__(object)“.顺便提一下,两边的下划线是均是2个 2. 每个程序块都要使用冒号!!!! 3. 如果程序中使用了非英文字符,需要在Python ...
- python3图片裁剪+转换pdf+压缩
本地大量长图,要发送给别人,所以要对图片进行裁剪+转换pdf+压缩 import zipfile import os from concurrent.futures import ThreadPool ...
- bash{} 方法总结
假设我们定义了一个变量为: file=/dir1/dir2/dir3/my.file.txt 我们可以用 ${ } 分别替换获得不同的值: ${file#*/}:拿掉第一条 / 及其左边的字串:dir ...
- 111个知名Java项目集锦,包括url和描述
转:http://www.cnblogs.com/wangs/p/3282183.html 项目名称 项目描述 ASM Java bytecode manipulation framework A ...
- Java文件读写
import java.io.*; public class Study { public static void main(String[] args) { try { String strPath ...
- 剑指offer系列55---最小的k个数
[题目] 输入n个整数,找出其中最小的K个数.例如输入4,5,1,6,2,7,3,8这8个数字,则最小的4个数字是1,2,3,4,. *[思路]排序,去除k后的数. package com.exe11 ...