Setup PopupMenuButton
<?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Script> import mx.controls.Menu private function initMenuData():void { Menu(popupMB.popUp).selectedIndex=2; } </mx:Script> <mx:XML id="fileMenuChoices" format="e4x"> <root> <fileItem label="New"/> <fileItem label="Open"/> <fileItem label="Save"/> <separator type="separator"/> <fileItem label="Exit"/> </root> </mx:XML> <mx:PopUpMenuButton id="popupMB" showRoot="false" labelField="@label" dataProvider="{fileMenuChoices}" creationComplete="initMenuData();"/> </mx:Application>