2. µ¼º½Àà×é¼þ
?
2.1 ToggleButtonBar µ¼º½°´Å¥×é
ToggleButtonBar ÊÇButtonBar µÄ×ÓÀ࣬ÔöÇ¿À´µ¼º½¹¦ÄÜ£¬¿ÉÒÔ³ÖÐø±£³Ö¿Í»§¶Ë״̬¡£
ͬʱÔÚ½çÃæÉ϶Ե±Ç°µÄÑ¡ÖÐ״̬×öÃ÷È·µÄ±êʶ¡£
?
toggleOnClick ÊôÐÔÖ¸Ã÷ÊÇ·ñ¿ÉÒÔͨ¹ýµ¥»÷È¡ÏûÑ¡ÖеÄ״̬¡£true£ºµ±Êó±êµ¥»÷ÒѾѡÖеݴťʱ£¬¸Ã°´Å¥»Ö¸´µ½Õý³£×´Ì¬¡£false£ºÔò²»»á»Ö¸´¡£
?
itemClick="btn_click_handler(event);" ¼àÌýÓû§µÄµ¥»÷¶¯×÷¡£
?
- <!---->??
- <mx:application?xmlns:mx="http: www.adobe.com="" 2006="" mxml"?layout="absolute" ??<="" li="">
- ?creationComplete="initUI()">??
- ????<mx:style?source="style.css">??
- ????<mx:script>??
- ????????<!---->
- ????????????//µ¼Èëµã»÷ʼþ¶ÔÏó ?
- ????????????import?mx.events.ItemClickEvent;???????? ?
- ????????????internal?function?initUI():void{ ?
- ????????????????var?data_arr:Array?=?new?Array(); ?
- ????????????????data_arr.push("<span?class=hilite1>Flex"); ?
- ????????????????data_arr.push("Flash"); ?
- ????????????????data_arr.push("Flash?Media?Server"); ?
- ????????????????data_arr.push("<span?class=hilite1>Flex?Data?Server"); ?
- ????????????????//Ìí¼ÓÊý¾ÝÔ´ ?
- ????????????????btns.dataProvider?=?data_arr; ?
- ????????????} ?
- ????????????//´¦ÀíitemClickµã»÷ʼþ ?
- ????????????internal?function?btn_click_handler(evt:ItemClickEvent):void{ ?
- ????????????????tip_txt.text?=?"µã»÷µÄ°´Å¥£º"+evt.index+":"+evt.label; ?
- ????????????} ?
- ????????]]>??
- ????</mx:script>??
- ????<mx:togglebuttonbar?toggleonclick="true"?id="btns"?itemclick="btn_click_handler(event);"? ??<="" li="">
- horizontalGap="5"?x="22"?y="82">??
- ????</mx:togglebuttonbar>??
- ???? ??
- ????<mx:label?id="tip_txt"?text="»¹Ã»Óеã»÷ÄØ"?x="22"?y="126"?width="266">??
- ???? ??
- </mx:application>??
<!----><mx:application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" ?creationcomplete="initUI()"> <mx:style source="style.css"> <mx:script> <!----> </mx:script> <mx:togglebuttonbar toggleonclick="true" id="btns" itemclick="btn_click_handler(event);" horizontalgap="5" x="22" y="82"> </mx:togglebuttonbar> <mx:label id="tip_txt" text="»¹Ã»Óеã»÷ÄØ" x="22" y="126" width="266"> </mx:application>
?
2.2? TabBar ±êÇ©×é
TabBar ÔÚToggleButtonBar µÄ»ù´¡ÉϼÌÐøÀ©Õ¹£¬¸Ä±äÁ˶ÔÑ¡ÖÐ״̬µÄ±íÏÖÐÎʽ£¬½«Ñ¡ÖÐÏîÒÔ±êÇ©µÄÐÎʽͻ³öÏÔʾ£¬Õâµã¸úTabNavigator Ïàͬ£¬²»¹ýËü²»°üÀ¨ÆäËû×Ó¼¶ÈÝÆ÷¡£
¿ÉºÍÈκÎ×é¼þ½áºÏʹÓ㬶ø²»½ö½öÏÞÓÚÈÝÆ÷¡£
TabBar ±¾ÉíÖ»°üÀ¨ÁËÒ»×é±êÇ©£¬Ã»ÓÐÆäËûÄÚÈÝ¡£
myViewstack.selectedIndex = evt.index;
½«TabBar µÄ°´Å¥Ë÷ÒýºÍViewStack µÄ±»Ñ¡ÖÐÔªËصÄλÖùØÁªÆðÀ´¡£
- <!---->??
- <mx:application?xmlns:mx="http: www.adobe.com="" 2006="" mxml"?layout="absolute">??
- ???? ??
- ????<mx:style?source="style.css">??
- ????<mx:script>??
- ????????<!---->
- ???????? ?
- ????????????import?mx.events.ItemClickEvent;???????? ?
- ???????? ?
- ????????????internal?function?btn_click_handler(evt:ItemClickEvent):void{ ?
- ????????????????myViewstack.selectedIndex?=?evt.index; ?
- ????????????} ?
- ????????]]>??
- ????</mx:script>??
- ???? ??
- ????<mx:panel?x="43"?y="10"?width="366"?height="310"?layout="absolute"?horizontalgap="0"?verticalgap="0"?title="tabbarʵÀý"?borderstyle="solid">??
- ????<mx:tabbar?id="btns"?x="10"?y="10"?width="308"?itemclick="btn_click_handler(event)">??
- ????????<mx:dataprovider>??
- ????????????<mx:array>??
- ????????????????<mx:string><span?class=hilite1>Flex</mx:string>??
- ????????????????<mx:string>Flash</mx:string>??
- ????????????????<mx:string>FMS</mx:string>??
- ????????????????<mx:string>FDS</mx:string>??
- ????????????</mx:array>??
- ????????</mx:dataprovider>??
- ????</mx:tabbar>??
- ????<mx:viewstack?x="10"?y="40"?id="myviewstack"?width="308"?height="200">??
- ????????<mx:canvas?id="child1"?label="view?1"?width="100%"?height="100%">??
- ????????????<mx:list>??
- ????????????????<mx:array>??
- ????????????????????<mx:object?label="ÇëÑ¡ÔñÄú¸ÐÐËȤµÄ¼¼Êõ£º">?????????????????? ??
- ????????????????????<mx:object?label="flash">??
- ????????????????????<mx:object?label="<span?class=hilite1>Flex"/>??
- ????????????????????<mx:object?label="flash?media?server">??
- ????????????????????<mx:object?label="breeze">??
- ????????????????</mx:array>??
- ????????????</mx:list>??
- ????????</mx:canvas>??
- ????????<mx:canvas?id="child2"?label="view?2"?width="100%"?height="100%">??
- ????????????<mx:textinput?text="ÇëÊäÈëÄúµÄÓÊÏäµØÖ·"?>??
- ????????????<mx:button?x="168"?y="1"?label="¶©ÔÄflash?rss">??
- ????????</mx:canvas>??
- ????????<mx:canvas?id="child3"?label="view?3"?width="100%"?height="100%">??
- ????????????<mx:label?text="fms?2.0.4·¢²¼ÁË"?>??
- ????????</mx:canvas>??
- ????????<mx:canvas?id="child4"?label="view?4"?width="100%"?height="100%">??
- ????????????<mx:label?text="breeze"?>??
- ????????</mx:canvas>??
- ????</mx:viewstack>??
- ????</mx:panel>??
- ???? ??
- </mx:application>??
<!----><mx:application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:style source="style.css"> <mx:script> <!----> </mx:script> <mx:panel x="43" y="10" width="366" height="310" layout="absolute" horizontalgap="0" verticalgap="0" title="TabBarʵÀý" borderstyle="solid"> <mx:tabbar id="btns" x="10" y="10" width="308" itemclick="btn_click_handler(event)"> <mx:dataprovider> <mx:array> <mx:string>Flex</mx:string> <mx:string>Flash</mx:string> <mx:string>FMS</mx:string> <mx:string>FDS</mx:string> </mx:array> </mx:dataprovider> </mx:tabbar> <mx:viewstack x="10" y="40" id="myViewstack" width="308" height="200"> <mx:canvas id="child1" label="View 1" width="100%" height="100%"> <mx:list> <mx:array> <mx:object label="ÇëÑ¡ÔñÄú¸ÐÐËȤµÄ¼¼Êõ£º"> <mx:object label="Flash"> <mx:object label="Flex"> <mx:object label="Flash Media server"> <mx:object label="Breeze"> </mx:array> </mx:list> </mx:canvas> <mx:canvas id="child2" label="View 2" width="100%" height="100%"> <mx:textinput text="ÇëÊäÈëÄúµÄÓÊÏäµØÖ·"> <mx:button x="168" y="1" label="¶©ÔÄFlash Rss"> </mx:canvas> <mx:canvas id="child3" label="View 3" width="100%" height="100%"> <mx:label text="FMS 2.0.4·¢²¼ÁË"> </mx:canvas> <mx:canvas id="child4" label="View 4" width="100%" height="100%"> <mx:label text="Breeze"> </mx:canvas> </mx:viewstack> </mx:panel> </mx:application>?
5.3 ʹÓò˵¥µ¼º½ -- ´´½¨Ò»¸ö¼òµ¥µÄ¶à¾Ã²Ëµ¥
ʹÓÃMenuBar ²Ëµ¥Ìõ×÷È«¾Öµ¼º½¡£
ÔÚʹÓÃAS ¶¨ÒåXML Êý¾Ýʱ£¬¿ÉÒÔʹÓû»Ðзû±£³ÖXMLÊý¾ÝµÄ¸ñʽ£¬Ö»ÒªXML µÄ±êÇ©ÕýÈ·£¬±àÒëÆ÷×Ô¶¯»áʶ±ð¡£
ÔÚnode ÔªËØÖÐµÄ enabled ÊôÐÔ ´ú±íÊÇ·ñ¿ÉÓã¬Ä¬ÈÏtrueΪ¿ÉÓã¬falseΪ²»¿ÉÓò˵¥Ïî±ä³É»ÒÉ«¡£
type ÊôÐÔ Îª separator ´ú±íÒ»¸ö·Ö¸îÏß¡£
?
XML ºÍ XMLList ¶¼ÊÇÓÃÀ´¶¨ÒåXML Êý¾Ý£¬²»Í¬µÄÊÇ£¬XMLList ÊǶà¸öXML Êý¾ÝµÄ¼¯ºÏ¡£
ÔÚÕâ¸öÀý×ÓÖУ¬mXMLÊÇXMLListÀàÐÍ£¬¸ù½Úµã±»ºöÂÔ£¬item ½Úµã±»½âÎöΪ¶ÀÁ¢µÄ XML Êý¾Ý¡£ item ½Úµã±ØÐëÓÐÒ»¸ö¸ù½Úµã£¬²»¿ÉºöÂÔ¡£
- <!---->??
- <mx:application?xmlns:mx="http: www.adobe.com="" 2006="" mxml"?layout="absolute" ?creationcomplete="initApp()">??
- ???? ??
- ????<mx:style?source="style.css">???????????? ??
- ????<mx:script>??
- ????????<!---->
- ????????????import?mx.controls.Alert;??????? ?
- ????????????import?mx.events.MenuEvent; ?
- ???????????? ?
- ????????????private?var?mXML:XML?= ?
- ????????????????<menu?label?=?"ϵͳ²Ëµ¥"> ?
- ????????????????????<item?label="Îļþ"> ?
- ????????????????????????<node?label="н¨»°å"?data="new"> ?
- ????????????????????????<node?label="Çå³ý»°å"?data="clear"?enabled="false"> ?
- ????????????????????????<node?type="separator"?> ?
- ????????????????????????<node?label="Í˳öϵͳ"?data="logout"> ?
- ????????????????????</item> ?
- ????????????????????<item?label="°ïÖú"> ?
- ????????????????????????<node?label="°ïÖú"?data="help"> ?
- ????????????????????????<node?label="¹ØÓÚ×÷Õß"?data="about"> ?
- ?????????????????????</item> ?
- ????????????????; ?
- ???????????? ?
- ????????????internal?function?initApp():void{ ?
- ????????????????//ΪMenuBarÌí¼ÓÊý¾ÝÔ´ ?
- ????????????????myMenu.dataProvider?=?mXML; ?
- ????????????????//¼àÌýMenuµÄµã»÷ʵ¼ù ?
- ????????????????myMenu.addEventListener(MenuEvent.ITEM_CLICK,menuClickHandler); ?
- ????????????} ?
- ???????????? ?
- ????????????internal?function?menuClickHandler(evt:MenuEvent):void{ ?
- ????????????????Alert.show("Ñ¡Ôñ²Ëµ¥£º"+evt.item.@data,"ÌáʾÐÅÏ¢"); ?
- ????????????} ?
- ????????]]>??
- ????</mx:script>??
- ????<mx:vbox?width="100%"?height="100%">??
- ????????<mx:canvas?stylename="windowbar"?width="100%">??
- ????????????<mx:menubar?labelfield="@label"??height="30"?id="mymenu"?width="100%"></mx:menubar>? ??
- ????????</mx:canvas>??
- ????????<mx:canvas?width="100%"?height="100%"?id="paper">??
- ???????????? ??
- ????????</mx:canvas>?????????? ??
- ????</mx:vbox>??
- ???? ??
- </mx:application>??
<!----><mx:application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationcomplete="initApp()"> <mx:style source="style.css"> <mx:script> <!----> <item label="Îļþ"> <node label="н¨»°å" data="new"> <node label="Çå³ý»°å" data="clear" enabled="false"> <node type="separator"> <node label="Í˳öϵͳ" data="logout"> </item> <item label="°ïÖú"> <node label="°ïÖú" data="help"> <node label="¹ØÓÚ×÷Õß" data="about"> </item> ; internal function initApp():void{ //ΪMenuBarÌí¼ÓÊý¾ÝÔ´ myMenu.dataProvider = mXML; //¼àÌýMenuµÄµã»÷ʵ¼ù myMenu.addEventListener(MenuEvent.ITEM_CLICK,menuClickHandler); } internal function menuClickHandler(evt:MenuEvent):void{ Alert.show("Ñ¡Ôñ²Ëµ¥£º"+evt.item.@data,"ÌáʾÐÅÏ¢"); } ]]> </mx:script> <mx:vbox width="100%" height="100%"> <mx:canvas stylename="windowBar" width="100%"> <mx:menubar labelfield="@label" height="30" id="myMenu" width="100%"></mx:menubar> </mx:canvas> <mx:canvas width="100%" height="100%" id="paper"> </mx:canvas> </mx:vbox> </mx:application>?
2.4 PopUpButton ÏÂÀµ¯³ö´°¿Ú¿Ø¼þ
PopUpButton ÊÇÒ»¸öÌØÊâµÄButton£¬ ±¾ÉíÓÉÁ½¸öButton×é³É£ºÖ÷°´Å¥ºÍ×Ó°´Å¥¡£µã»÷×Ó°´Å¥¿ÉÒÔ½«ÈκÎ×é¼þ×÷Ϊ´°¿Úµ¯³ö£¬ÖÃÓÚ×îÉϲ㡣Õâ¸öµ¯³ö¶¯×÷ÓÉ PopUpMenuButton Íê³É¡£
PopUpButton µÄopen ʼþºÍ close ʼþ£ºµ¯³öºÍµ¯³ö´°¿Ú¹Ø±Õʱ´¥·¢¡£
popUp ÊôÐÔ£º½«Òªµ¯³öµÄ¶ÔÏó¡£
DropdownEvent.CLOSE ºÍ DropdownEvent.OPEN ʼþרÃÅÕë¶Ôµ¯³ö´°¿Ú¡£µã»÷Ö÷°´Å¥£¬´¥·¢µÄʼþºÍButton ÊÇÒ»ÑùµÄ£¬±ÈÈçclick¡£
?
- <!---->??
- <mx:application?xmlns:mx="http: www.adobe.com="" 2006="" mxml"?creationcomplete="initApp()" ?layout="absolute">??
- ????<mx:style>??
- ????????Application{ ??
- ????????????fontSize:12; ??
- ????????????backgroundGradientColors:?#c0c0c0,?#c0c0c0; ??
- ????????} ??
- ????</mx:style>??
- ????<mx:script>??
- ????????<!---->
- ????????????import?mx.containers.Panel;????? ?
- ????????????import?mx.controls.Alert;??? ?
- ????????????import?mx.events.DropdownEvent; ?
- ?
- ????????????private?var?panel:Panel; ?
- ?
- ????????????private?function?initApp():void?{ ?
- ????????????????panel?=?new?Panel();??//ÉùÃ÷еÄPanel ?
- ????????????????panel.title?=?"panel"; ?
- ????????????????panel.width?=?200; ?
- ????????????????panel.height?=?200; ?
- ????????????????popBtn.popUp?=?panel;???????????//Ö¸¶¨popUpÄ¿±ê¶ÔÏó??????? ?
- ????????????????popBtn.addEventListener(DropdownEvent.CLOSE,closeHandler);??//?????????? ?
- ????????????????popBtn.open();??????//½«´°¿Úµ¯³ö ?
- ????????????}??????????? ?
- ?
- ???????????? ?
- ????????????private?function?closeHandler(evt:DropdownEvent):void{ ?
- ????????????????Alert.show("¹Ø±Õ´°¿Ú"); ?
- ????????????} ?
- ????????]]>??
- ????</mx:script>??
- ????<mx:popupbutton?id="popbtn"?label="µ¯³ö"?width="135"??x="23"?y="23">??
- ???? ??
- </mx:application>??
<!----><mx:application xmlns:mx="http://www.adobe.com/2006/mxml" creationcomplete="initApp()" layout="absolute"> <mx:style> Application{ fontSize:12; backgroundGradientColors: #c0c0c0, #c0c0c0; } </mx:style> <mx:script> <!----> </mx:script> <mx:popupbutton id="popBtn" label="µ¯³ö" width="135" x="23" y="23"> </mx:application>?
2.5 PopUpMenuButton
¼Ì³Ð×ÔPopUpButton£¬ÊÇ PopUpButtonµÄÒ»¸öÌØÊâʵÀý¡£Ö»ÄÜ°ÑMenu µ±×÷µ¯³ö´°¿Ú£¬ÇÒMenu Ö»ÄÜÓÐ1¸ø²ã¼¶¡£
Menu ÓÃÀ´´´½¨²Ëµ¥£¬²»¹ýºÍ MenuÏà±È£¬ËüÉÙÁ˲˵¥Ìõ¡£ÇÒûÓжÔÓ¦µÄMXML±êÇ©£¬Ö»ÄÜÓÉ´úÂë´´½¨¡£
PopUpMenuButton ÖÐÄÚÖÃÁËÒ»¸öMenu ¡£
¶¨ÒåXML Êý¾Ý£¬½«Ëü´«¸ø PopUpMenuButton µÄ dataProvider £¬×÷ΪÄÚÖõÄMenu µÄÊý¾ÝÔ´¡£
MenuEvent.ITEM_CLICK ʼþ£ºµ±²Ëµ¥ÏѡÖÐʱ£¬Ê¼þ±»´¥·¢£¬Í¬Ê±²Ëµ¥¹Ø±Õ¡£
- <!---->??
- <mx:application?xmlns:mx="http: www.adobe.com="" 2006="" mxml"?creationcomplete="initApp()" ?layout="absolute">??
- ????<mx:style>??
- ????????Application{ ??
- ????????????fontSize:12; ??
- ????????????backgroundGradientColors:?#c0c0c0,?#c0c0c0; ??
- ????????} ??
- ????</mx:style>??
- ????<mx:script>??
- ????????<!---->
- ????????????import?mx.controls.Alert;??? ?
- ????????????import?mx.events.MenuEvent; ?
- ???????????? ?
- ????????????private?var?mXML:XMLList?= ?
- ????????????????<> ?
- ????????????????????<node?label="Îļþ"> ?
- ????????????????????????<node?label="н¨»°å"?data="new"> ?
- ????????????????????????<node?label="Çå³ý»°å"?data="clear"?enabled="false"> ?
- ????????????????????????<node?label="Í˳öϵͳ"?data="logout"> ?
- ????????????????????</node> ?
- ????????????????????<node?label="¹¤¾ß">???????????????????????? ?
- ????????????????????<node?label="°ïÖú"> ?
- ????????????????????????<node?label="°ïÖú"?data="help"> ?
- ????????????????????????<node?label="¹ØÓÚ×÷Õß"?data="about"> ?
- ?????????????????????</node> ?
- ????????????????; ?
- ????????????private?function?initApp():void?{ ?
- ????????????????popBtn.dataProvider?=?mXML;?//µ¯³ö²Ëµ¥µÄÊý¾ÝÔ´ ?
- ????????????????popBtn.addEventListener(MenuEvent.ITEM_CLICK,clickHandler);? ?
- ????????????}??????????? ?
- ????????????private?function?clickHandler(evt:MenuEvent):void{ ?
- ????????????????Alert.show("Ñ¡Ôñ²Ëµ¥£º"+evt.label+":²Ëµ¥ÐòºÅ£º"+evt.index); ?
- ????????????} ?
- ????????]]>??
- ????</mx:script>??
- ????<mx:popupmenubutton?id="popbtn"?labelfield="@label"?width="135"??x="23"?y="23">??
- ???? ??
- </mx:application>??
1.8 DataGrid ×é¼þ -- ÖÆ×÷ͼÊéÑ¡¹ºÁбí
DataGrid×é¼þµÄ×÷ÓúÍHTMLÒ³ÃæÖеıí¸ñÀàËÆ£¬½«Êý¾ÝÒÔÐС¢ÁеĸñʽÏÔʾ³öÀ´¡£
?
ÿһ×ÝÁеĿí¶È²»¶¨£¬Óû§¿ÉÒÔÔÚÔËÐÐʱµ÷Õû¿í¶È¡£
¿ÉÔÚÔËÐÐʱµ÷ÕûÁеÄ˳Ðò
µã»÷ÁбêÌâÀ¸¿É¶ÔÁÐÊý¾Ý½øÐÐÅÅÐò
¿ÉÒÔ×Ô¶¨ÒåÿÁеıêÌâÀ¸
ºÍList×é¼þÒ»Ñù£¬¿ÉÒÔ×Ô¶¨Òåÿ¸öµ¥Ôª¸ñµÄitemRenderer
?
ʹÓÃModel¶¨ÒåÊý¾ÝÔ´£¬
columns ¶¨ÒåÁËËùÓеÄÁУ¬ÆäÖÐDataGridColumn ´ú±íÒ»ÁеÄÐÅÏ¢£¬dataFieldµÄÖµ²»¿ÉÊ¡ÂÔ£¬Õâ¸öÖµ±ØÐëÊÇÊý¾ÝÔ´ÖÐÿÌõÊý¾Ý°üº¬µÄÊôÐÔÃû£¬·ñÔòÎÞ·¨ÏÔʾ¡£headerText ±íʾÁбêÌâ¡£
rowCount ±íʾÏÔʾµÄÐÐÊý£¬Èç¹ûheightûÓÐÉèÖã¬ÔòÓÃÕâ¸öÊôÐÔÀ´¼¼Êõ¸ß¶È¡£height=rowCount*rowHeightÐиߡ£
selectedItem ÊôÐÔ´ú±íµ±Ç°Ñ¡ÖÐÐеÄÊý¾Ý£¬¿ÉÒÔÔÚÊý¾Ý°ó¶¨ÖУ¬µ±ËüµÄÖµ·¢Éú±ä»¯Ê±£¬Ê¹ÓøÃÊôÐÔµÄÈκÎÎï¼þ¶¼»á×Ô¶¯¸üС£
?
½Ó×ÅÎÒÃÇÀûÓÃitemRenderer ÔÚDataGridÖмÓÈ븴ѡ¿ò´´½¨×é¼þ£º
ÔÚ×é¼þÖÐÌí¼ÓÒ»¸ö¸´Ñ¡¿ò¡£²¢Ìí¼ÓchangeʼþµÄ·½·¨addCart¡£
this.parentApplication ±íʾ¸¸Application£¬¾ÍÊÇÎÒÃǺóÃæʹÓøÃ×é¼þµÄApplication¡£
new cartEvent(data,cart_check.selected)
addCart ·½·¨´´½¨ÁËÒ»¸ö×Ô¶¨Òåʼþ cartEvent ʼþ£¬²¢ÇÒ½«±ØÒªµÄÊôÐÔ´«µ½¸Ãʼþ£¬
È»ºóͨ¹ý dispatchEvent ÅÉ·¢¸Ãʼþ¡£
?
- <!---->??
- <mx:canvas?xmlns:mx="http: www.adobe.com="" 2006="" mxml"="">??
- ????<mx:script>??
- ????????<!---->
- ????????????import?bookEvent.cartEvent; ?
- ????????????internal?function?addCart():void{ ?
- ????????????????this.parentApplication.dispatchEvent(new?cartEvent(data,cart_check.selected)); ?
- ????????????} ?
- ????????]]>??
- ????</mx:script>??
- ????<mx:checkbox?id="cart_check"?x="0"?y="0"?label="¹ºÂò"?change="addcart()">??
- </mx:canvas>??
<!----><mx:canvas xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:script> <!----> </mx:script> <mx:checkbox id="cart_check" x="0" y="0" label="¹ºÂò" change="addCart()"></mx:canvas>
ÒÔÏÂΪ¶¨ÒåÒ»¸öcartEvent ʼþÀࣺ
ËùÓеÄʼþ¼Ì³ÐEvent£¬ ÔÚ¹¹Ô캯ÊýÖж¨ÒåÁËÁ½¸ö²ÎÊý£º_data ºÍ _isAdd£¬´´½¨Ê¼þµÄʱºò£¬½«Í¨¹ýÕâÁ½¸ö²ÎÊý½«ÐÅÏ¢´«ÈëʼþÖС£
super("AddBook") µ÷Óø¸ÀàEvent µÄ¹¹Ô캯Êý£¬²¢°ÑʼþÀàÐÍ¡°AddBook¡±´«µÝ¹ýÈ¥¡£Ö»Óе÷ÓÃÁ˸¸ÀàµÄ¹¹Ô캯Êý£¬²ÅÄܳÉΪÕæÕýµÄʼþ¶ÔÏó¡£
- package?bookEvent ??
- { ??
- ????import?flash.events.Event; ??
- ??
- ????public?class?cartEvent?extends?Event{ ??
- ????????public?var?isAdd:Boolean; ??
- ????????public?var?book:Object; ??
- ????????function?cartEvent(_data:Object,_isAdd:Boolean):void{ ??
- ????????????isAdd?=?_isAdd; ??
- ????????????book?=?_data; ??
- ???????????? ??
- ????????????super("AddBook"); ??
- ????????} ??
- ????} ??
- }??
package bookEvent{ import flash.events.Event; public class cartEvent extends Event{ public var isAdd:Boolean; public var book:Object; function cartEvent(_data:Object,_isAdd:Boolean):void{ isAdd = _isAdd; book = _data; super("AddBook"); } }}?
½ÓÏÂÀ´ÊÇÖ÷³ÌÐò¡£
ÔÚ³ÌÐò³õʼ»¯º¯ÊýÖУ¬addEventListener("AddBook",AddHandler) Ϊµ±Ç°¶ÔÏóÌí¼ÓÁ˶ÔAddBookʼþµÄ¼àÌý¡£
- <!---->??
- <mx:application?xmlns:mx="http: www.adobe.com="" 2006="" mxml"?fontsize="12" ?creationcomplete="initApp()">??
- ????????<mx:script>??
- ????????????<!---->
- ????????????????import?mx.events.DataGridEvent; ?
- ????????????????import?mx.events.DataGridEventReason ?
- ????????????????import?bookEvent.cartEvent; ?
- ????????????????import?view.*; ?
- ???????????????? ?
- ????????????????internal?function?initApp():void{ ?
- ????????????????????addEventListener("AddBook",AddHandler); ?
- ????????????????} ?
- ????????????????internal?function?AddHandler(evt:cartEvent):void{ ?
- ????????????????????if(evt.isAdd){ ?
- ????????????????????????tip_txt.text?=?"ÄãÑ¡Ôñ¹ºÂò£º"+evt.book.name; ?
- ????????????????????}else{ ?
- ????????????????????????tip_txt.text?=?"Äã·ÅÆú¹ºÂò£º"+evt.book.name; ?
- ????????????????????} ?
- ????????????????} ?
- ???????????????? ?
- ????????????????internal?function?checkInfo(evt:DataGridEvent):void{ ?
- ????????????????????//Èç¹ûûÓÐ×÷ÐÞ¸Ä ?
- ????????????????????if?(evt.reason?==?DataGridEventReason.CANCELLED){ ?
- ????????????????????????return; ?
- ????????????????????} ?
- ????????????????????//È·¶¨Ð޸ĵÄÊôÐÔ ?
- ????????????????????if(evt.dataField?==?"date"){ ?
- ????????????????????????//?Çå³ýÔÀ´µÄÊý¾Ý ?
- ????????????????????????evt.preventDefault(); ?
- ????????????????????????//?µÃµ½ÐµÄÊý¾Ý ?
- ????????????????????????book_DG.editedItemRenderer.data.date?=?dateCell(DataGrid(evt.target).itemEditorInstance).num_year.value; ?
- ????????????????????????//?¹Ø±Õitem?editor ?
- ????????????????????????book_DG.destroyItemEditor();? ?
- ????????????????????????//¸üÐÂÊý¾ÝÔ´? ?
- ????????????????????????book_DG.dataProvider.itemUpdated(evt.itemRenderer.data); ?
- ????????????????????} ?
- ????????????????} ?
- ????????????]]>??
- ????????</mx:script>??
- ????????<mx:model?id="books">??
- ????????????<datas>??
- ????????????????<book>??
- ????????????????????<name>FlashµÚÒ»²½</name>??
- ????????????????????<author>³Â±ù</author>??
- ????????????????????<date>2006</date>??
- ????????????????</book>??
- ????????????????<book>??
- ????????????????????<name>FlexµÚÒ»²½</name>??
- ????????????????????<author>walktree</author>??
- ????????????????????<date>2007</date>??
- ????????????????</book>??
- ????????????????<book>??
- ????????????????????<name>ApolloµÚÒ»²½</name>??
- ????????????????????<author>»¹²»ÖªµÀÄØ</author>??
- ????????????????????<date>2008</date>??
- ????????????????</book>??
- ????????????</datas>??
- ????????</mx:model>???? ??
- ????????<mx:label?width="100%"?color="#004080"?text="Ñ¡ÔñÒ»±¾Ê鹺Âò">??
- ????????<mx:datagrid?editable="true"?id="book_dg"?width="100%"?height="156"?itemeditend="checkinfo(event)"?rowcount="5"?dataprovider="{books.book}">??
- ????????????<mx:columns>??
- ????????????????<mx:datagridcolumn?datafield="name"?headertext="ÊéÃû">??
- ????????????????<mx:datagridcolumn?datafield="author"?headertext="×÷Õß">??
- ????????????????<mx:datagridcolumn?datafield="date"?headertext="³ö°æÈÕÆÚ"?itemeditor="view.datecell"?>??
- ????????????????<mx:datagridcolumn?headertext="¹ºÂò"?itemrenderer="view.cartcell"?editable="false">??
- ????????????</mx:columns>??
- ????????</mx:datagrid>??
- ???????? ??
- ????????<mx:canvas?height="150"?width="100%"?backgroundcolor="#ffffff">??
- ????????<mx:label?id="tip_txt"?text="»¹Ã»ÓÐÑ¡ÔñÊéÄ¿">??? ??
- ????????</mx:canvas>??
- ??
- </mx:application>??
<!----><mx:application xmlns:mx="http://www.adobe.com/2006/mxml" fontsize="12" creationcomplete="initApp()"> <mx:script> <!----> </mx:script> <mx:model id="books"> <datas> <book> <name>FlashµÚÒ»²½</name> <author>³Â±ù</author> <date>2006</date> </book> <book> <name>FlexµÚÒ»²½</name> <author>walktree</author> <date>2007</date> </book> <book> <name>ApolloµÚÒ»²½</name> <author>»¹²»ÖªµÀÄØ</author> <date>2008</date> </book> </datas> </mx:model> <mx:label width="100%" color="#004080" text="Ñ¡ÔñÒ»±¾Ê鹺Âò"> <mx:datagrid editable="true" id="book_DG" width="100%" height="156" itemeditend="checkInfo(event)" rowcount="5" dataprovider="{books.book}"> <mx:columns> <mx:datagridcolumn datafield="name" headertext="ÊéÃû"> <mx:datagridcolumn datafield="author" headertext="×÷Õß"> <mx:datagridcolumn datafield="date" headertext="³ö°æÈÕÆÚ" itemeditor="view.dateCell"> <mx:datagridcolumn headertext="¹ºÂò" itemrenderer="view.cartCell" editable="false"> </mx:columns> </mx:datagrid> <mx:canvas height="150" width="100%" backgroundcolor="#ffffff"> <mx:label id="tip_txt" text="»¹Ã»ÓÐÑ¡ÔñÊéÄ¿"> </mx:canvas></mx:application>
?
´ËÍ⻹ÓÐheaderRenderer ¿ØÖƱêÌâÀ¸µÄ½çÃæ ºÍ itemEditor ¿ØÖƵ¥Ôª¸ñÖбà¼×´Ì¬ÏµĽçÃ棬ʹÓøúitemRendererÒ»Ñù¡£ÒªÊ¹ÓÃitemEditor±ØÐ뽫DataGrid µÄeditable ÊôÐÔÉèΪtrue¡£»¹ÒªÉèÖú¯ÊýÀ´´¦Àí±à¼Íê³Éʼþ£¬¸üÐÂÊý¾Ý¡£Ö÷³ÌÐò´úÂë¼ûÉÏÃæ ¡£
?
½Ó×ÅÎÒÃÇÔÙ¶¨ÒåÒ»¸ö×é¼þ£º
ÔÚÏÂÃæµÄ×é¼þÖУ¬Ê¹ÓÃÁËNumericStepper Êý×ÖÑ¡Ôñ¿Ø¼þÀ´Ìṩ±ã½Ý²Ù×÷¡£
ÔÚÓû§Íê³É±à¼µ¥Ôª¸ñÊý¾Ýºó£¬itemEditEndʼþ½«±»´¥·¢£¬DataGridEvent ʼþ±»ÅÉ·¢³öÈ¥£¬Òò´ËʹÓüàÌýº¯Êý£ºitemEditEnd="checkInfo(event)"
if (evt.reason == DataGridEventReason.CANCELLED) ¼ì²éʼþµÄÀàÐÍ
- <!---->??
- <mx:canvas?xmlns:mx="http: www.adobe.com="" 2006="" mxml"?width="180">??
- ????<mx:numericstepper?id="num_year"?x="0"?y="0"?minimum="1900"?maximum="2100"?value="{data.date}">??
- ????<mx:label?text="ÇëÑ¡ÔñÄê·Ý"?x="96"?y="2">??
- </mx:canvas>??
相关推荐
ѹËõ°üÀﺬÓÐ×¢²á»úºÍºº»¯Îļþ Èí¼þÆƽâ×¢²á¼°ºº»¯ËµÃ÷ Æƽⷽ·¨1£º 1¡¢°²×°DemoĿ¼ÏµÄÎļþ 2¡¢°ÑCrackĿ¼µÄÈ«²...
½ÎªÎïÒµ¹ÜÀíÉçÇø»òÎïÒµ¹ÜÀíÔ±£¬ÎïҵʹÓÃÈËΪÊÜÍз½¡£ÎïÒµ¹ÜÀíίÍðºÍºÏ֮ͬºÏ£¬ÎïÒµ¹ÜÀíÉçÇøºÍÎïÒµ¹ÜÀíÔ±ºÜ¿...
ÎïÀí²Î×ÓÔÚ³ö²¥¹ý³ÌÖ中断²é×îºó¡°³É¹¦¡±¡£ÎïÀí²Î×Ó³ö²¥¹ý³ÌÖеIJÎÊýÇó³öºó£¬¿ÉÒÔÖ±½ÓÓÃÓÚÎïÀíÔìÎï¡¢Éú³É³É¹¦µ...
»ý·ÖÖƹÜÀíÊÇÒ»ÖÖÓɲÎÓëÕß×ÔÈ»·ÖÅä²¢ÇÒÓëÈÎÎñ³É¹¦Óë³ö²»³É¹¦×éºÏµÄ¹ÜÀí·½·¨¡£ËüÔÚIT业界²¢²»ÊDZê×¼µÄ¹ÜÀí³£Óàµ...
1. ¼¯Èº·þÎñÆ÷ÅäÖ㬰üÀ¨°²×°²Ù×÷ϵͳ¡¢¹Ø±Õ·À»ðǽ¡¢Í¬²½·þÎñÆ÷ʱÖӵȣ» 2. °²×°Cloudera ¹ÜÀíÆ÷£» 3. °²×°CDH ¼¯Èº£» 4. ...
ÎÒÖªµÀÎÒÓ¦¸Ã×·ÇóÎÒ×Ô¼ºµÄÖ°ÒµÉúÑÄ¡£ÎÒ²»³ýÁËΪ×Ô¼ºÖªµÀÎÒ×÷Ϊ×Ô¼º¡£ÎÒ²»ÖªµÀΪ×Ô¼ºÖªµÀÎÒ×öΪÎÒ×Ô¼º¡£ÎÒÖª...
static void DAC1_Mode_Config(void) { DAC_InitTypeDef DAC_InitType; DAC_InitType.DAC_Trigger=DAC_Trigger_None; //²»Ê¹Óô¥·¢¹¦Ä... //12λÓÒ¶ÔÆëÊý¾Ý¸ñʽÉèÖÃDACÖµ }
¹ãÖÝÊÐÐÇÒíµç×ӿƼ¼ÓÐÏÞ¹«Ë¾ ×÷ÕߣºÕýµãÔ×Ó @ALIENTEK ************************************************/ int main(void) { u8 key; u8 i=0,t=...
5. ÐźŴ¦Àíϵͳ: ÓÉÓڲɼæµÄζÈֵΪ拟Ðźţ¬Îª×ª»»³ÉÊý字Ðźţ¬ÎÒÃÇÓ¦ÓùǼÜÔöÁ¿·Ö¿ª¡£Î±Î²ÔÚÕâÀïʹÓÃÁ˱ê×¼µ...
Ó׶ùÔ°½ÌÓýÖ¸µ¼Ö®Ò»¾ÍÊÇÉùÃ÷Ó׶ùÔ°µÄÈÏÖªÖ÷Ìå×é³É¡£°à³ÉÔ±²ÉÓù淶ÎÄ×é×é×÷·ÖÎöºó£¬ÎÒÃÇ¿ÉÒÔ¿ªÊ¼ÉùÃ÷ÈÏÖª·...
×¢ Ò⣺ÏÈÏòEEPROMдָ¶¨Êý¾Ý£¬È»ºóÔÙ¶Á³öÀ´£¬×îºóͨ¹ýRS232·¢Ë͵½µçÄÔÉÏ£¬ ÒÔÑéÖ¤¶ÁдÊÇ·ñÕýÈ· *********************************...
ֲο¼²é¿ö£¬ÎÒ¿ªÊ¼²ÎÓë³É¹¦×îÖØÒªµÄ×ܳɹ¦¿Î³Ì¡£ÎÒ³õʼ³É¹¦×ö³öÁ˲¿·Ö²Î¿¼²é¿ö£¬²»¹ýÎÒÈ·ÈÏ×Ô¼º²»ÖªµÀ×ܳɹ...
¾ßÓн»Í¨ÏµÍ³µÄ±à¼ºÍÓû§²éѯµÈ¹¦ÄÜ£» ÓɳÂÓ£¬Âí±ó£¬»ª³É£¬Ìïê¿»Ô£¬ÍõÑó£¬ÕÅÒæç⣬¶ÅæÂ棬·ëºì࣬ÀîÄê...
//½ÓÊÕÊý¾Ý»º´æÇø int mcy; //±íʾ½øλ±ê־λ uint date[4]; uint dis_data; //±äÁ¿ //unsigned int ge,shi,bai,qian,wan; void GPIOConfig(void) { GPIO_InitTypeDef GPIO...
½·¨¡£3 / 10ÊèÉ¢Òýµ导读组:Á¬ºóÖ°Îñ³ö²é×éºÍ¿Í·þ×飬²é¿´Îï×ʲúÊÇ·ñºÏ·À»ð¹æÔò£¬È·ÈÏÉ豸Çå¹Ü¡¢ÉèÖú͹ÜÀíÈ·ÈϺܺ...
µç»úÂß¼µçƽ PB12(×óÇ°Ç°½ø),PB13(ÓÒÇ°ºóÍË),PB14£¨×óÇ°ºóÍË£©,PB15£¨ÓÒÇ°Ç°½ø£©,PE12£¨×óºóÇ°½ø£©,PE13£¨ÓÒºóÇ°½ø£©,PE14£¨×ó...
¹ãÖÝÊÐÐÇÒíµç×ӿƼ¼ÓÐÏÞ¹«Ë¾ ×÷ÕߣºÕýµãÔ×Ó @ALIENTEK ************************************************/ int main(void) { u16 t; u16 len; u...
//ÎÞÓ²¼þÊý¾ÝÁ÷¿ØÖÆ USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx; //ÊÕ·¢Ä£Ê½ USART_Init(USART3, &USART;_InitStructure); //³õʼ»¯´®¿Ú 3 USART_...
// Êý¾Ý¿â״̬:"0"±íʾÊý¾Ý¿â´¦ÔڹرÕ״̬,"1"±íʾÊý¾Ý¿âÕý³£´ò¿ª,"2"±íʾÊý¾Ý¿â´¦ÔÚ¹ÒÆð״̬ int DbConnNum; // Êý¾Ý¿âÁ¬½Ó...
Ò»¾ä»°³£ÓÃÃÜÂë+3λ×ÖĸÊý×Ö