<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
verticalAlign="middle"
backgroundColor="white"
initialize="init();" viewSourceURL="srcview/index.html">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.ListEvent;
[Bindable]
[Embed("assets/flex_logo.jpg")]
private var flex_icon:Class;
private function init():void {
btn.addEventListener("labelPlacementChanged", btn_labelPlacementChanged);
}
private function comboBox_change(evt:ListEvent):void {
var obj:Object = ComboBox(evt.currentTarget).selectedItem;
btn.labelPlacement = obj.label;
}
private function btn_labelPlacementChanged(evt:Event):void {
Alert.show(evt.toString(), evt.type);
}
]]>
</mx:Script>
<mx:ApplicationControlBar dock="true">
<mx:Form styleName="plain">
<mx:FormItem label="labelPlacement:">
<mx:ComboBox id="comboBox"
selectedIndex="1"
change="comboBox_change(event);">
<mx:dataProvider>
<mx:Array>
<mx:Object label="left" />
<mx:Object label="right" />
<mx:Object label="top" />
<mx:Object label="bottom" />
</mx:Array>
</mx:dataProvider>
</mx:ComboBox>
</mx:FormItem>
</mx:Form>
</mx:ApplicationControlBar>
<mx:Button id="btn"
label="Button"
icon="{flex_icon}"
width="200"
height="100" />
</mx:Application>