flex组件使用【MenuBar】
发布时间:2020-12-15 03:42:40 所属栏目:百科 来源:网络整理
导读:?xml?version="1.0"?encoding="utf-8"?mx:Application?xmlns:mx="http://www.adobe.com/2006/mxml"?layout="absolute"?creationComplete="initCollrction();"?mx:Panel?x="73"?y="10"?width="503"?height="293"?layout="absolute"???????????????!--@label表
<?xml?version="1.0"?encoding="utf-8"?> <mx:Application?xmlns:mx="http://www.adobe.com/2006/mxml"?layout="absolute"?creationComplete="initCollrction();"> ?<mx:Panel?x="73"?y="10"?width="503"?height="293"?layout="absolute">???????????????<!--@label表示节点中的label值--> ??<mx:MenuBar?itemClick="menuevent(event)"?x="0"?y="0"?width="483"?height="36"?dataProvider="{xmllistcollection}"?labelField="@label"></mx:MenuBar> ??<mx:TextArea?x="0"?y="35"?width="483"?height="218"?id="txtall"/> ?</mx:Panel> ?<mx:Script> ??<![CDATA[ ???import?mx.controls.MenuBar; ???import?mx.controls.Alert; ???import?mx.events.MenuEvent; ???import?mx.collections.*; ???[Bindable] ???public?var?xmllistcollection:XMLListCollection; ???private?var?xmllist:XMLList= ???<> ????<menuitem?label="文件"?data="file"> ?????<menuitem?label="打开"?data="new"/> ?????<menuitem?label="保存"?data="save"/> ?????<menuitem?type="separator"/> ?????<menuitem?label="关闭"?data="close"/> ????</menuitem> ????<menuitem?label="编辑"?data="edit"> ?????<menuitem?label="撤销"?data="undo"?type="check"/> ?????<menuitem?label="重做"?data="redo"?type="check"/> ?????<menuitem?type="separator"/> ?????<menuitem?label="操作"?data="command"> ??????<menuitem?label="剪贴"?type="radio"?data="cut"?groupName="one"/> ??????<menuitem?label="复制"?type="radio"?data="copy"?groupName="one"/> ?????</menuitem> ????</menuitem> ???</>; ??? ???private?function?initCollrction():void{ ????xmllistcollection=new?XMLListCollection(xmllist); ???} ??? ???private?function?menuevent(event:MenuEvent):void{ ????txtall.text+=event.label+"-"+event.index+"n"; ???} ??? ??]]> ?</mx:Script> </mx:Application> ? (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |