+展开-XML
<mx:Application
xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
creationComplete="initApp(event)">
<mx:MenuBar id="menu" dataProvider="{menu_dp}"/>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;
import mx.events.FlexEvent;
[Bindable]
private var menu_dp:ArrayCollection;
private function initApp(evt:FlexEvent):void {
var temp:Array = new Array();
var subNodes:ArrayCollection = new ArrayCollection([
{label:"New"},{label:"Open"},
{label:"Close",enabled:false}]);
temp.push({label:"File",children:subNodes});
temp.push({label:"Edit"});
temp.push({label:"Source"});
subNodes = new ArrayCollection( [
{label:"50%", type:"radio", groupName:"one"},
{label:"100%", type:"radio",
groupName:"one",selected:true},
{label:"150%",type:"radio",groupName:"one"}]);
temp.push({label:"View",children:subNodes});
menu_dp = new ArrayCollection(temp);
}
]]>
</mx:Script>
</mx:Application>