flex 加载modulecontrol module20什么作用

小弟是新手 忘各位大哥指点哈小弟&
flex4 里面的 controlBarContent 怎么设置它的样式(要为它设置背景色 或者用一张背景图片平铺)
或者 有什么其它方法能够实现这样的效果??
可以在里面加入一个容器 设置这个容器的背景图
实现的方式有很多中
已解决问题
未解决问题当前位置: >>
Flex - Menu Control
Introduction
The Menu control creates a pop-up menu of singly selectable choices or menu-items. The popped up menu can have as many levels of submenus as needed.
Class declaration
Following is the declaration for mx.controls.Menu class:
public class Menu
extends List
implements IFocusManagerContainer
Public properties
S.N.Property & Description
1dataDescriptor : IMenuDataDescriptorThe object that accesses and manipulates data in the data provider.
2hasRoot : Boolean[read-only] A flag that indicates that the current data prov for example, a single top node in a hierarchical structure.
3parentMenu : MenuThe parent menu in a hierarchical chain of menus, where the current menu is a submenu of the parent.
4showRoot : BooleanA Boolean flag that specifies whether to display the data provider's root node.
Public methods
S.N.Method & Description
1Menu()Constructor.
2createMenu(parent:DisplayObjectContainer, mdp:Object, showRoot:Boolean = true):Menu[static] Creates and returns an instance of the Menu class.
3hide():voidHides the Menu control and any of its submenus if the Menu control is visible.
4popUpMenu(menu:Menu, parent:DisplayObjectContainer, mdp:Object):void[static] Sets the dataProvider of an existing Menu control and places the Menu control in the specified parent container.
5show(xShow:Object = null, yShow:Object = null):voidShows the Menu control.
Protected Methods
S.N.Method & Description
1makeListData(data:Object, uid:String, rowNum:int):BaseListData[override] Creates a new MenuListData instance and populates the fields based on the input data provider item.
2measure():void[override] Calculates the preferred width and height of the Menu based on the widths and heights of its menu items.
3setMenuItemToggled(item:Object, toggle:Boolean):voidToggles the menu item.
S.N.Event & Description
1changeDispatched when selection changes as a result of user interaction.
2itemClickDispatched when a menu item is selected.
3itemRollOutDispatched when a user rolls the mouse out of a menu item.
4itemRollOverDispatched when a user rolls the mouse over a menu item.
5menuHideDispatched when a menu or submenu is dismissed.
6menuShowDispatched when a menu or submenu opens.
Methods inherited
This class inherits methods from the following classes:
mx.controls.List
mx.controls.listClasses.ListBase
mx.core.ScrollControlBase
mx.core.UIComponent
mx.core.FlexSprite
flash.display.Sprite
flash.display.DisplayObjectContainer
flash.display.InteractiveObject
flash.display.DisplayObject
flash.events.EventDispatcher
Flex Menu Control Example
Let us follow the following steps to check usage of Menu control in a Flex application by creating a test application:
StepDescription
1Create a project with a name HelloWorld under a package com.yiibai.client as explained in the Flex - Create Application chapter.
2Modify HelloWorld.mxml as explained below. Keep rest of the files unchanged.
3Compile and run the application to make sure business logic is working as per the requirements.
Following is the content of the modified mxml file src/com.yiibai/HelloWorld.mxml.
&?xml version="1.0" encoding="utf-8"?&
&s:Application xmlns:fx="/mxml/2009"
xmlns:s="library:///flex/spark"
xmlns:mx="library:///flex/mx"
width="100%" height="100%" minWidth="500" minHeight="500"
&fx:Style source="/com/yiibai/client/Style.css"/&
&fx:Script&
import mx.controls.M
import mx.events.MenuE
protected var menu:M
protected function showMenu(event:MouseEvent):void
menu = Menu.createMenu(null, menuData, false);
menu.labelField="@label";
menu.show(mainContainer.x+menuPanel.x+ 2,
mainContainer.y +menuPanel.y+32);
menu.addEventListener(MenuEvent.CHANGE,onMenuChange);
protected function hideMenu(event:MouseEvent):void
menu.hide();
protected function onMenuChange(event:MenuEvent):void
lblSelected.text =
&/fx:Script&
&fx:Declarations&
&fx:XML format="e4x" id="menuData"&
&menuitem label="Menu Item A" &
&menuitem label="SubMenu Item A 1" enabled="false"/&
&menuitem label="SubMenu Item A 2"/&
&/menuitem&
&menuitem label="Menu Item B" type="check" toggled="true"/&
&menuitem label="Menu Item C" type="check" toggled="false"/&
&menuitem type="separator"/&
&menuitem label="Menu Item D" &
&menuitem label="SubMenu Item D 1" type="radio"
groupName="one"/&
&menuitem label="SubMenu Item D 2" type="radio"
groupName="one" toggled="true"/&
&menuitem label="SubMenu Item D 3" type="radio"
groupName="one"/&
&/menuitem&
&/fx:Declarations&
&s:BorderContainer width="630" height="480" id="mainContainer"
styleName="container"&
&s:VGroup width="100%" height="100%" gap="50"
horizontalAlign="center" verticalAlign="middle"&
&s:Label id="lblHeader" text="Complex Controls Demonstration"
fontSize="40" color="0x777777" styleName="heading"/&
&s:Panel id="menuPanel" title="Using Menu" width="500"
height="300"&
&s:layout&
&s:VerticalLayout
gap="10" verticalAlign="middle"
horizontalAlign="center"/&
&/s:layout&
&s:HGroup&
&s:Button label="Show Menu" click="showMenu(event)" /&
&s:Button label="Hide Menu" click="hideMenu(event)" /&
&/s:HGroup&
&s:HGroup&
&s:Label text="Menu Item selected:" /&
&s:Label id="lblSelected" fontWeight="bold"/&
&/s:HGroup&
&/s:Panel&
&/s:VGroup&
&/s:BorderContainer&
&/s:Application&
Once you are ready with all the changes done, let us compile and run the application in normal mode as we did in
chapter. If everything is fine with your application, this will produce following result: [
贡献/合作者
正在开放中...
还没有评论!1003人阅读
flex(84)
&?xml version=&1.0& encoding=&utf-8&?&
&mx:Application xmlns:mx=&/2006/mxml& layout=&absolute&&
&mx:Script&
import mx.events.EffectE
import mx.events.MoveE
private var is_center:Boolean =
private var y_pos:int = 0;
private function slide_center():void {
if (!is_center) {
//记下按钮原位置
y_pos = btnSlide.y;
//将按钮从control bar中移出
acbMain.removeChild(btnSlide);
//加入到主场景以便滑动
this.addChild(btnSlide);
btnSlide.move(btnSlide.x, stage.height/2 - acbMain.height/2);
is_center =
btnSlide.move(btnSlide.x, y_pos);
private function on_effectend(e:EffectEvent):void {
//为了能够看见按钮回去的过程,要在移动结束后才将它归还control bar控件
//相反操作即可让按钮回到bar上去
if (is_center && btnSlide.hitTestObject(acbMain)) {
this.removeChild(btnSlide);
acbMain.addChild(btnSlide);
is_center =
&/mx:Script&
&mx:ApplicationControlBar x=&0& y=&0& width=&100%& id=&acbMain&&
&mx:Button label=&Click Me& click=&slide_center()& id=&btnSlide& moveEffect=&Move& effectEnd=&on_effectend(event)&/&
&/mx:ApplicationControlBar&
&/mx:Application&
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:367394次
积分:4219
积分:4219
排名:第4201名
原创:19篇
转载:185篇
评论:38条
(2)(6)(17)(21)(19)(15)(22)(24)(11)(1)(4)(2)(11)(24)(4)(3)(18)扫扫二维码,随身浏览文档
手机或平板扫扫即可继续访问
New_40_RT-flex_Control-System_Chinese
举报该文档为侵权文档。
举报该文档含有违规或不良信息。
反馈该文档无法正常浏览。
举报该文档为重复文档。
推荐理由:
将文档分享至:
分享完整地址
文档地址:
粘贴到BBS或博客
flash地址:
支持嵌入FLASH地址的网站使用
html代码:
&embed src='/DocinViewer--144.swf' width='100%' height='600' type=application/x-shockwave-flash ALLOWFULLSCREEN='true' ALLOWSCRIPTACCESS='always'&&/embed&
450px*300px480px*400px650px*490px
支持嵌入HTML代码的网站使用
您的内容已经提交成功
您所提交的内容需要审核后才能发布,请您等待!
3秒自动关闭窗口

我要回帖

更多关于 flex moduleloader 的文章

 

随机推荐