<?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系列 —— 打开和关闭弹出菜单的更多相关文章

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

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

  2. jq点击按钮打开和关闭弹出层,点击除了当前按钮以外的地方关闭弹出层

    1.html <a id="more" onclick="moreFun()">更多</a> <ul id="moreL ...

  3. Mui --- 弹出菜单

    mui框架内置了弹出菜单插件,弹出菜单显示内容不限,但必须包裹在一个含.mui-popover类的div中,如下即为一个弹出菜单内容: <div id="popover" c ...

  4. 解决Mui中popover 顶部弹出菜单弹出位置不准确以及无法收回的问题

    前言 最近公司的项目转向使用Hbuilder开发移动端项目,其中想要通过在顶部标题栏加入弹出菜单的方式,来定位长列表的位置,如图所示. 问题 Mui的功能貌似还不是很完善,在使用这个弹出菜单的时候,发 ...

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

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

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

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

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

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

  8. [Flex] 组件Tree系列 —— 作为PopUpButton的弹出菜单

    mxml: <?xml version="1.0" encoding="utf-8"?> <!--功能描述:Tree作为PopUpButton ...

  9. MUI - 打开页面默认弹出键盘及返回关闭键盘

    打开页面默认弹出键盘及返回关闭键盘 http://www.cnblogs.com/phillyx/ (function(keyboard) { var openSoftKeyboard = funct ...

随机推荐

  1. Visual Studio 文件没发布出来

    解决办法是选择文件打开属性窗口找到生成操作,选项选择"内容",重新发布,OK,问题解决.

  2. Web前端开发笔试&面试_05_other 2016104399MS

    1.数据传送的方式,get post 的区别是? 2.你要怎么绑定页码(比如给你第三页,)? 3.数据流是如何实现,用for 循环? 4.轮播怎么实现?用原生JS实现. 5.布局,B是固定宽度,A的内 ...

  3. 【转】asp.net连接数据库字符串有哪些写法[数据连接]

    来源:http://blog.unvs.cn/archives/database-link-method.html 下面是个人总结的net网站连接数据库的字符串几种写法: 一.结合webconfig位 ...

  4. Java单元测试技术1

    另外两篇关于介绍easemock的文章:EasyMock 使用方法与原理剖析,使用 EasyMock 更轻松地进行测试 摘要:本文针对当前业软开发现状,先分析了WEB开发的技术特点和单元测试要解决的问 ...

  5. Centos Mysql 升级

    如何升级CentOS 6.5下的MySQL CentOS 6.5自带安装了MySQL 5.1,但5.1有诸多限制,而实际开发中,我们也已经使用MySQL 5.6,这导致部分脚本在MySQL 5.1中执 ...

  6. Activation successful 数据库邮件无法发送

    问题现象: 配置好数据库邮件后发送测试邮件. 在数据库邮件发送日志中显示状态为:Activation successful.而邮件是无法收到的. 解决方法: 本次解决是将SQL Server Agen ...

  7. [算法] 数据结构之AVL树

    1 .基本概念 AVL树的复杂程度真是比二叉搜索树高了整整一个数量级——它的原理并不难弄懂,但要把它用代码实现出来还真的有点费脑筋.下面我们来看看: 1.1  AVL树是什么? AVL树本质上还是一棵 ...

  8. PHP基础学习笔记(一)

    1.初步了解PHP+ php是一种运行在服务端的跨平台的脚本语言. + php语法: <?php echo "welcome!": ?> php像javascript语 ...

  9. LintCode "Submatrix Sum"

    Naive solution is O(n^4). But on 1 certain dimension, naive O(n^2) can be O(n) by this well-known eq ...

  10. 在VS 2010中使用 VS2013的解决方案

    本文转载自:http://blog.csdn.net/u011543589/article/details/25563351 今天要用VS2010打开VS2013,一直觉得VS2010到VS2012只 ...