加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

flex中的menuBar

发布时间:2020-12-15 05:11:26 所属栏目:百科 来源:网络整理
导读:? ?xml version="1.0" encoding="utf-8"?s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600" creationComplete="application
?
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
			   creationComplete="application1_creationCompleteHandler(event)">
	<s:layout>
		<s:BasicLayout/>
	</s:layout>

	<fx:Script>
		<![CDATA[
			import mx.controls.Alert;
			import mx.events.FlexEvent;
			import mx.events.MenuEvent;

			protected function menubar1_itemClickHandler(event:MenuEvent):void
			{
				Alert.show(event.item.@label);
			}


			protected function application1_creationCompleteHandler(event:FlexEvent):void
			{
				var dp:Array = [
					{label:"Flash动画王",data:"id_001"},{label:"Flash开发王",{label:"Flex开发王",data:"id_001"}
				];
				pmb.dataProvider = menu_data;
				pmb.labelField="@label";
				pmb.showRoot=false;
			}

		]]>
	</fx:Script>
	<fx:Declarations>
		<fx:XML id="menu_data">
			<root>
				<menuitem label="第一菜单" eventName="item1">
					<submenuitem label="子菜单一" eventName="subitem1"/>
				</menuitem>
				<menuitem label="第二菜单" eventName="item2">
					<submenuitem label="子菜单二" eventName="subitem1"/>
				</menuitem>
			</root>
		</fx:XML>
	</fx:Declarations>
	<mx:MenuBar x="200" y="100" dataProvider="{menu_data}"
				labelField="@label" showRoot="false" itemClick="menubar1_itemClickHandler(event)"/>
	
	<mx:PopUpMenuButton id="pmb" x="400" y="100" />
	
	<mx:MenuBar x="200" y="300" 	labelField="@label" showRoot="false" itemClick="menubar1_itemClickHandler(event)">
		<mx:dataProvider>
			<fx:XML>
				<root>
					<menuitem label="第一菜单" eventName="item1">
						<submenuitem label="子菜单一" eventName="subitem1"/>
					</menuitem>
					<menuitem label="第二菜单" eventName="item2">
						<submenuitem label="子菜单二" eventName="subitem1"/>
					</menuitem>
				</root>
			</fx:XML>
		</mx:dataProvider>		
	</mx:MenuBar>
	
</s:Application>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读