PopUpMenuButton and XMLList data provider : PopUpMenuButton « Components « Flex






PopUpMenuButton and XMLList data provider

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

1.Setup data provider for PopUpMenuButtonSetup data provider for PopUpMenuButton
2.PopUpMenuButton click eventPopUpMenuButton click event
3.Hard code data provider for PopUpMenuButton
4.Menu Separator for PopupMenuButtonMenu Separator for PopupMenuButton
5.Setup PopupMenuButtonSetup PopupMenuButton
6.Create PopUpMenuButton from ArrayCreate PopUpMenuButton from Array
7.Click event for PopUpMenuButtonClick event for PopUpMenuButton
8.Create a PopUpMenuButton control using an E4X XML data provider.Create a PopUpMenuButton control using an E4X XML data provider.
9.Use PopUpMenuButton change event to set the labelUse PopUpMenuButton change event to set the label
10.Use XMLListCollection as the PopUpMenuButton data sourceUse XMLListCollection as the PopUpMenuButton data source
11.Item click event for PopUpMenuButtonItem click event for PopUpMenuButton
12.how the PopUpMenuButton generates events and how an application can handle themhow the PopUpMenuButton generates events and how an application can handle them
13.Creating a PopUpMenuButton controlCreating a PopUpMenuButton control
14.To use a dynamic label property, use a PopUpMenuButton control change event listenerTo use a dynamic label property, use a PopUpMenuButton control change event listener