¶ÔÓÚÒ»¸öÓµÓзḻ×é¼þµÄGUIÉè¼Æ¹¤¾ßÀ´Ëµ£¬½çÃæµÄ²¼¾Ö¼¼Êõ³ÉΪ½çÃæÃÀ»¯µÄÒ»¸öÖØÒª·½Ãæ¡£Flex´Ó¿Ø¼þµÄ¹¦ÄÜÉÏ´óÖÂÌṩÁËÁ½ÖÖ·½·¨£ºÈÝÆ÷£¨¿ØÖƲ¼¾Ö£©£¬×é¼þ£¨ÌṩGUIʵÖʹ¦ÄÜ´¦Àí£©¡£Ê¹ÓÃÈÝÆ÷·Ö²ã´Î¹ÜÀíGUIÊǵ±Ç°µÄÇ÷ÊÆ,FlexҲʹÓÃÁË´ËÖÖ·½Ê½,Ö÷¹ÛÉÏÎÒÃÇÈÏΪËü°ÑÎÒÃǽçÃæÉϵÄ×é¼þͨ¹ýÈÝÆ÷½øÐÐÁË·Ö×é»ò·ÖÀ಼¾Ö¹ÜÀí¡£

½ÓÏÂÀ´£¬ÎÒ½«Í¨¹ý¼òµ¥µÄʾÀýÖð¸ö½éÉܸ÷ÖÖ½çÃæ²¼¾ÖµÄÉè¼Æ¡£
CanvasµÄ½çÃæ²¼¾Ö£¬Ëü¶¨ÒåÁËÒ»¸ö¾ØÐοò¼ÜµÄÇøÓò£¬ÓÃÀ´·ÅÖÃÓû§µÄÈÝÆ÷ºÍ¿Ø¼þ¡£²»ÏñÆäËûµÄ×é¼þ£¬Äã²»ÄÜ·ÅÈÎFlexµÄ¿Ø¼þ¡£Äã±ØÐëÖ¸¶¨absolute»òÕßconstraint-basedÀ´Ö¸¶¨×é¼þµÄλÖá£Absoluteģʽ±ØÐëÖ¸¶¨x,y×ø±ê¡£ Constrain-based±ØÐëÖ¸¶¨side, baseline,»òÕßcenter anchors. ½ÓÏÂÀ´¾ßÌå½éÉÜÁ½ÖÖ²¼¾Ö·½Ê½£º
Absoluteģʽ£ºÄã¿ÉÒÔÖ¸¶¨x,y×ø±êÀ´Ö¸¶¨Ã¿¸ö×é¼þµÄÔÚÈÝÆ÷µÄλÖá£×ø±êµÄÊÇÏà¶Ôcanvas ÈÝÆ÷µÄ×óÉϽÇÀ´Éè¼ÆµÄ¡£¼´ÈÝÆ÷µÄ×óÉϽÇ×ø±êΪ(0,0). X.y¿ÉÒÔΪÕý¸ºÖµ£¬Èç¹ûÊǸºÖµµÄ»°£¬×é¼þ¾Í»á·ÅÔÚ³¬³öÈÝÆ÷¿ÉÊÇ·¶Î§µÄλÖᣵ±È»¿ÉÒÔÀûÓÃActionscriptÀ´Íê³ÉÒÆ¶¯µÄ²Ù×÷£¬Õâ¾ÍÉæ¼°µ½µÄeventʼþ¡£
|
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" width="219" height="230"> <mx:Canvas id="mycanvas" height="182" width="200" borderStyle="solid" backgroundColor="white"> <mx:Button x="10" y="10" label="button1"/> <mx:Button x="50" y="67" label="Button2"/> <mx:Button x="92" y="129" label="Button3"/> </mx:Canvas> </mx:WindowedApplication>
|
Ч¹ûÈçÏÂͼ£º

constraint-basedģʽ£ºÕâ¸ö·Ö±ð½éÉÜcanvas µÄVboxÒÔ¼°HboxµÄÁ½ÖÖ×éºÏ¡£Canvasͨ³£ÓÐx,yÖ¸¶¨×é¼þµÄλÖã¬x,yĬÈϵÄÓ¦¸ÃÊÇ0.ËùÒÔÄãÈç¹û²»Ö¸¶¨x,ÄÇô½«°Ñ×é¼þ·ÅÔÚx=0,µÄλÖá£ÕâÑùÓпÉÄܳöÏÖÖØµþÏÖÏó¡£µ±È»Ò²¿ÉÒÔÖ¸¶¨ÆäËûģʽµÄ²¼¾Ö£¬±ÈÈçVbox,»òÕßHbox¡£ÕâÑù¾Í¿ÉÒÔ²»Ö¸¶¨x,yÁË¡£
|
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Canvas width="340" height="247" backgroundColor="#FFFFFF"> <mx:VBox id="vb" left="10" right="248" y="26" height="153" backgroundColor="#A9C0E7"> <mx:Button label="button1" width="74"/> <mx:Button label="Button2"/> <mx:Button label="Button3"/> </mx:VBox> <mx:HBox id="hBox2" left="100" right="27" y="26" height="153" backgroundColor="#A9C0E7"> <mx:Button label="button4" /> <mx:Button label="Button5"/> <mx:Button label="Button6"/> </mx:HBox> <mx:Button label="Button8" y="200"/> <mx:Button label="Button7" y="190"/> </mx:Canvas>
</mx:WindowedApplication>
|
Ч¹ûÈçÏÂͼ£º
Vbox»òÕßHbox ²¼¾Ö
Ç°Ãæ½éÉܵİÑVbox»òÕßHboxǶÈëCanvas¡£ÆäʵËûÃDZ¾Éí¶¼ÊÇÒ»¸öÈÝÆ÷£¬¿ÉÒÔ¶ÀÁ¢Ê¹Óõġ£Ð§¹û¸úÉÏÃæÍ¼ÖÐÏÔʾµÄÊÇÒ»ÑùµÄ¡£ËùÒÔ¹ØÓÚVBox£¬HBox¾Í²»ÔÙ¼ÓÒÔ½éÉÜÁË¡£¾Ù¸öÀý×ÓºÃÁË£º
|
<?xml version="1.0"?> <!-- containers\layouts\VBoxSimple.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:VBox borderStyle="solid" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"> <mx:Button id="fname" label="Button 1"/> <mx:Button id="lname" label="Button 2"/> <mx:Button id="addr1" label="Button 3"/> <mx:ComboBox id="state"> <mx:ArrayCollection> <mx:String>ComboBox 1</mx:String> </mx:ArrayCollection> </mx:ComboBox> </mx:VBox> </mx:Application>
|
Ч¹ûͼÈçÏ£º

Äã¿ÉÒÔ°ÑcontrolbarºÍpanel »òÕßtitlewindowÈÝÆ÷×éºÏÆðÀ´Ê¹Óá£ÕâÑù×öµÄºÃ´¦ÈÝÆ÷ÀïµÄ×é¼þ¿ÉÒÔ±»panel»òÕßtitlewindowÀïµÄ×é¼þ¹²Óᣣ¨ÔÎÄ£ºYou use the ControlBar container with a Panel or TitleWindow container to hold components that can be shared by the other children in the Panel or TitleWindow container.£©¾Ù¸öÀý×Ó£º
|
<?xml version="1.0" encoding="utf-8"?> <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ private function addToCart():void { // Handle event. } ]]> </mx:Script> <mx:Panel title="My Application" paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10"> <mx:HBox width="250" height="200"> <!-- Area for your catalog. --> </mx:HBox> <mx:ControlBar width="250"> <mx:Label text="Quantity"/> <mx:NumericStepper/> <!-- Use Spacer to push Button control to the right. --> <mx:Spacer width="100%"/> <mx:Button label="Add to Cart" click="addToCart();"/> </mx:ControlBar> </mx:Panel> </mx:WindowedApplication>
|
Ч¹ûͼ£º

Õâ¸öÖ÷ÒªÓÃÀ´×ö½çÃæ¶¥²¿µÄµ¼º½Ìõ¡£Õâ¸öÈÝÆ÷menubar, combox buttonµÈ×é¼þ¡£¾Ù¸öÀý×Ó£º
|
<?xml version="1.0"?> <!-- containers\layouts\AppCBarSimple.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ import mx.controls.Alert; ]]> </mx:Script> <mx:XMLList id="menuXML"> <menuitem label="File"> <menuitem label="New" data="New"/> <menuitem label="Open" data="Open"/> <menuitem label="Save" data="Save"/> <menuitem label="Exit" data="Exit"/> </menuitem> <menuitem label="Edit"> <menuitem label="Cut" data="Cut"/> <menuitem label="Copy" data="Copy"/> <menuitem label="Paste" data="Paste"/> </menuitem> <menuitem label="View"/> </mx:XMLList> <mx:Array id="cmbDP"> <mx:String>Item 1</mx:String> <mx:String>Item 2</mx:String> <mx:String>Item 3</mx:String> </mx:Array> <mx:ApplicationControlBar id="dockedBar" dock="true"> <mx:MenuBar height="100%" dataProvider="{menuXML}" labelField="@label" showRoot="true"/> <mx:HBox paddingBottom="5" paddingTop="5"> <mx:ComboBox dataProvider="{cmbDP}"/> <mx:Spacer width="100%"/> <mx:TextInput id="myTI" text=""/> <mx:Button id="srch1" label="Search" click="Alert.show('Searching')"/> </mx:HBox> </mx:ApplicationControlBar> <mx:TextArea width="300" height="200"/> </mx:Application>
|
Ч¹ûͼ£º

ÆäÊµÄØ£¬DividedBox,ÓëBox ÊǷdz£ÀàËÆµÄ£¬Î¨Ò»²»Í¬µÄÔÚÓÚËü×ÓBox°å¿é×Ô½¨¼ÓÈëÁËÒ»Ìõ·Ö¸ôÌõ£¬Óû§¿ÉÒÔ¸ü¾ß×Ô¼ºÐèÒªÀ´µ÷Õû¸÷¸ö×ÓBox°å¿éµÄ´óС¡£×ÓBox°å¿éµÄ·Ö²¼¿ÉÒÔ·Ö³ÉÁ½ÖÖ£¬Ë®Æ½ÒÔ¼°´¹Ö±µÄ¡£±ÈÈ磺
ʵÏֵĴúÂëÈçÏ£º
|
<?xml version="1.0"?> <!-- containers\layouts\HDivBoxSimple.mxml --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" backgroundColor="white"> <mx:Script> <![CDATA[ private function myGrid_initialize():void { myGrid.dataProvider = [ {Artist:'Pavement', Album:'Slanted and Enchanted', Price:11.99, Comment:'One of their best. 4 Stars.'}, {Artist:'Pavement', Album:'Brighten the Corners', Price:11.99, Comment:'My favorite.'} ]; } ]]> </mx:Script> <mx:HDividedBox width="100%" height="100%"> <mx:Tree id="tree1" width="30%" height="100%" labelField="@label" showRoot="true"> <mx:XMLList> <menuitem label="Products"> <menuitem label="Posters" isBranch="true"/> <menuitem label="CDs"> <menuitem label="Pavement"/> <menuitem label="Pavarotti"/> <menuitem label="Phish"/> </menuitem> <menuitem label="T-shirts" isBranch="true"/> <menuitem label="Tickets" isBranch="true"/> </menuitem> </mx:XMLList> </mx:Tree> <mx:VDividedBox width="70%" height="100%"> <mx:DataGrid id="myGrid" width="100%" height="100%" initialize="myGrid_initialize();" change="currentMessage.text= event.currentTarget.selectedItem.Comment;"/> <mx:TextArea id="currentMessage" width="100%" height="60" text="One of their best. 4 Stars."/> </mx:VDividedBox> </mx:HDividedBox> </mx:Application>
|
£££££££££££££££££££££££££££££££££££