PopUpMenuButton and XMLList data provider
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
import mx.controls.Alert;
import mx.events.MenuEvent;
public function itemClickHandler(event:MenuEvent):void {
Alert.show("Menu label: " + event.item.@label,"Menu value: " + event.item.@value);
}
</mx:Script>
<mx:XMLList id="xSizes">
<node label="A" value="a"/>
<node label="B" value="b"/>
<node label="C" value="c"/>
</mx:XMLList>
<mx:Panel title="PopUpMenuButton Demo" layout="horizontal">
<mx:PopUpMenuButton id="p2"
dataProvider="{xSizes}"
labelField="@label"
itemClick="itemClickHandler(event);"/>
</mx:Panel>
</mx:Application>
Related examples in the same category