⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 menutest.mxml

📁 Java界面解决方案。使用FLEX和后台数据库通讯。完美界面效果。可作为BS系统的参考。
💻 MXML
字号:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="ini()"
 preloader="myDownloadBar" >
<mx:Script>
	<![CDATA[
		import mx.events.MenuEvent;
		import mx.controls.Alert;
		import mx.binding.utils.BindingUtils;
		import mx.controls.menuClasses.IMenuDataDescriptor;
		import mx.collections.XMLListCollection;
		import mx.controls.MenuBar;
	[Bindable]
	public var books:XML =
	 <books>
                    <menuitem label="Menu1" data="top">
                        <menuitem label="MenuItem 1-A" data="1A"/>
                        <menuitem label="MenuItem 1-B" data="1B"/>
                    </menuitem>
                    <menuitem label="Menu2" data="top">
                        <menuitem label="MenuItem 2-A" type="check"  data="2A"/>
                        <menuitem type="separator"/>
                        <menuitem label="MenuItem 2-B" >
                            <menuitem label="SubMenuItem 3-A" type="radio"
                                groupName="one" data="3A"/>
                            <menuitem label="SubMenuItem 3-B" type="radio"
                                groupName="one" data="3B"/>
                        </menuitem>
                    </menuitem>
	 </books>;
	 
	  [Embed(source="img/comein_2.gif")]
      public var img:Class;
	  [Embed(source="img/icon_yr.gif")]
      public var ico_yr:Class;
	  [Embed(source="img/icon_tx.gif")]
      public var ico_tx:Class;

	public var books2:XML=
                    <menuitem label="Menu3" data="top" icon="ico_tx" >
                        <menuitem label="MenuItem 1-A" data="1A"  icon="img" enabled="false"/>
                        <menuitem label="MenuItem 1-B" data="1B" type="check"  icon="ico_tx" />
                        <menuitem label="MenuItem 1-C" data="1C"  icon="img" />
                        <menuitem label="MenuItem 1-D" data="1D"  icon="ico_yr" />
                    </menuitem>;

	 	
	//public var menu:MenuBar;
	[Bindable]
    public var menuBarCollection:XMLListCollection;
    
    public var m:MenuBar = new MenuBar;

	public function ini():void
	{
		this.addChild(m);		
		menuBarCollection = new XMLListCollection(books.children());
        m.labelField = 	"@label";
        m.iconField = 	"@icon";
        m.addEventListener(MenuEvent.ITEM_CLICK,menuClick);
        m.dataProvider	= menuBarCollection;
	}
	public function creaMenu():void
	{
		menuBarCollection.addItem(books2);
		//menuBarCollection.removeItemAt(0);
	}
	
	public function menuClick(ev:MenuEvent):void
	{
		Alert.show(ev.item.@label);
	}
		
	]]>
</mx:Script>

	<mx:Panel id="pan" x="36" y="58" width="485" height="500" layout="absolute">
		<mx:Button x="295" y="286" label="Button" id="btn" click="{creaMenu()}"/>
	</mx:Panel>
	<mx:ProgressBar x="298" y="626" id="probar"/>
	
</mx:Application>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -