flex入门--初学笔记1
环境:flashBuilder + eclipse 4.2
基本控件:
1 <mx:Script> 2 <![CDATA[ 3 import mx.controls.Alert; 4 public function showMsg(msg:String):void{ 5 mx.controls.Alert.show(msg); 6 } 7 ]]> 8 </mx:Script> 9 <mx:Panel title="常用控件" width="100%" height="100%"> 10 <mx:Label text="常用控件" color="red"/> 11 <mx:Form> 12 <mx:FormHeading label="常用控件" horizontalCenter="center" color="red"/> 13 <mx:FormItem label="TextInput" fontWeight="bold" > 14 <mx:TextInput id="yourName" width="250" /> 15 </mx:FormItem> 16 17 <mx:FormItem label="TextArea" fontWeight="bold" > 18 <mx:TextArea id="aboutYou" textAlign="center" width="250" /> 19 </mx:FormItem> 20 21 <mx:FormItem label="RichTextEditor" fontWeight="bold" > 22 <mx:RichTextEditor id="rte" height="150"/> 23 </mx:FormItem> 24 25 <mx:FormItem label="DateField" fontWeight="bold" > 26 <mx:DateField text="12/05/2008" id="thisDateField" change="showMsg(thisDateField.selectedDate.toString())"/> 27 </mx:FormItem> 28 29 <mx:FormItem label="LinkBar" fontWeight="bold" > 30 <mx:LinkBar id="thisLinkBar" dataProvider="{['One','Two','Three']}"/> 31 </mx:FormItem> 32 33 34 <mx:FormItem label="ButtonBar" fontWeight="bold" > 35 <mx:ButtonBar id="thisBtnBar" dataProvider="{['One','Two','Three']}"/> 36 </mx:FormItem> 37 38 <mx:FormItem label="ToggleButtonBar" fontWeight="bold" > 39 <mx:ToggleButtonBar id="thisToggleBar" dataProvider="{['One','Two','Three']}"/> 40 </mx:FormItem> 41 42 <mx:FormItem label="CheckBox" fontWeight="bold" > 43 <mx:HBox> 44 <mx:CheckBox id="s1" label="选择1" click="showMsg(''+s1.selected)"/> 45 <mx:CheckBox id="s2" label="选择2" click="showMsg(''+s2.selected)"/> 46 </mx:HBox> 47 </mx:FormItem> 48 49 <mx:FormItem label="RadioButtonGroup" fontWeight="bold" > 50 <mx:HBox> 51 <mx:RadioButtonGroup id="spam"/> 52 <mx:RadioButton id="yes" 53 groupName="spam" 54 label="yes" /> 55 <mx:RadioButton id="no" 56 groupName="spam" 57 label="no"/> 58 </mx:HBox> 59 60 </mx:FormItem> 61 </mx:Form> 62 63 </mx:Panel>
<mx:Accordion>
1 <mx:Accordion id="myAccordion" headerHeight="25" x="30" y="40" width="800" height="400" textAlign="center"> 2 <mx:Canvas label="幼儿园" width="100%" height="130"> 4 <mx:Image id="img1" source="@Embed(source='pic/2.jpg')" width="100%" height="900" toolTip="pic/2.jpg" /> </mx:Canvas> 8 <mx:Canvas label="小学" width="100%" height="130"> 9 <mx:Image id="img2" source="@Embed(source='pic/3.jpg')" width="100%" height="130" toolTip="pic/3.jpg" /> 10 </mx:Canvas> 11 <mx:Canvas label="初中" width="100%" height="130"> 12 <mx:Image id="img3" source="@Embed(source='pic/4.jpg')" width="100%" height="130" toolTip="pic/4.jpg" /> 13 </mx:Canvas> 14 <mx:Canvas label="高中" width="100%" height="130"> 15 <mx:Image id="img4" source="@Embed(source='pic/5.jpg')" width="100%" height="130" toolTip="pic/5.jpg" /> 16 </mx:Canvas> 17 <mx:Canvas label="大学" width="100%" height="130"> 18 <mx:Image id="img5" source="@Embed(source='pic/6.jpg')" width="100%" height="130" toolTip="pic/6.jpg" /> 19 </mx:Canvas> 22 </mx:Accordion>
疑惑:flex 中使用WebService ? WebService?