<?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. 用CorelDRAW勾画对象轮廓图的方法

    轮廓图效果是利用渐变的步数来使图形产生渐变效果,与调和效果相似.两者的区别在于图形数不同,调和效果作用于两个或两个以上的图形,轮廓图只作用于一个图形.本教程将详解CorelDRAW中如何勾画对象轮廓图 ...

  2. OSPF(Open Shortest Path First开放式最短路径优先 -链路状态路由协议

    OSPF分为OSPFv2和OSPFv3两个版本,其中OSPFv2用在IPv4网络,OSPFv3用在IPv6网络 思科OSPF的协议管理距离(AD)是110,华为OSPF的协议管理距离是10 通告网络接 ...

  3. Html.BeginForm())与Ajax.BeginForm()

     一.@using (Html.BeginForm())参数示例 1.指定表单提交方式和路径等 @using (Html.BeginForm("Index", "Home ...

  4. matlab批量灰色预测

    没事玩了一下matlab 发现现在网上的代码都是一组数据预测 所以我就写个批量数据的预测 顺便学习下matlab ----------------------------------我是快乐的分割线- ...

  5. hadoop spark学习笔记

    http://www.csdn.net/article/2015-06-08/2824889 hive:是基于Hadoop的一个数据仓库工具,可以将结构化的数据文件映射为一张数据库表,并提供简单的sq ...

  6. 基于jQuery动态创建html元素

    在做web前端开发的时候,经常遇到一些数据多少或则类型不能在运行之前就确定下来的情况,此时,数据的展示,就要借助于动态创建html元素来展示了. 常见的动态创建HTML元素的方式,有如下几种,大体都差 ...

  7. Android禁止横屏竖屏切换

    在Android中要让一个程序的界面始终保持一个方向,不随手机方向转动而变化的办法: 只要在AndroidManifest.xml里面配置一下就可以了. 在AndroidManifest.xml的ac ...

  8. js 标签云效果

    下载:http://files.cnblogs.com/zjfree/js_tag_list.rar 效果如下: 源码如下: <html> <head> <meta ht ...

  9. LintCode "Sliding Window Median" & "Data Stream Median"

    Besides heap, multiset<int> can also be used: class Solution { void removeOnly1(multiset<in ...

  10. 剑指offer系列28--字符流中第一个不重复的字符

    [题目]请实现一个函数用来找出字符流中第一个只出现一次的字符.例如,当从字符流中只读出前两个字符”go”时,第一个只出现一次的字符是”g”.当从该字符流中读出前六个字符“google”时,第一个只出现 ...