<?xml version="1.0" encoding="utf-8"?>
<!--为主按钮添加默认图标 PopUpButtonIcon.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:Declarations>
<!-- 将非可视元素(例如服务、值对象)放在此处 -->
<fx:Array id="arr">
<fx:Object label="《霹雳先锋》香港票房8916612" />
<fx:Object label="《捕风汉子》香港票房3149395" />
<fx:Object label="《小偷阿星》香港票房7968106 " />
<fx:Object label="笑傲江湖之东方不败(1992)" />
<fx:Object label="精武英雄(1994)" />
<fx:Object label="给爸爸的信(1995)" />
</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;
}
</fx:Style>
<fx:Script>
<![CDATA[
import mx.controls.Menu;
import mx.events.FlexEvent;
[Bindable]
[Embed(source="assets/icon.png")]
private var iconClass:Class;
[Bindable]
private var menu:Menu;
protected function popUpButton_initializeHandler(event:FlexEvent):void
{
menu = new Menu();
menu.dataProvider = arr;
}
]]>
</fx:Script>
<mx:PopUpButton id="popUpButton" label="Please select an item..." icon="{iconClass}" popUp="{menu}" initialize="popUpButton_initializeHandler(event)"/>
</s:Application>