main.mxml
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Applicationxmlns:mx="http://www.adobe.com/2006/mxml"
- layout="vertical"
- verticalAlign="middle"
- backgroundColor="white">
- <mx:Style>
- .myBox {
- paddingLeft: 10;
- paddingRight: 10;
- paddingTop: 10;
- paddingBottom: 10;
- backgroundColor: haloSilver;
- }
- </mx:Style>
- <mx:Script>
- <![CDATA[
- import mx.events.ListEvent;
- import mx.containers.BoxDirection;
- private function comboBox_init():void {
- var arr:Array = [];
- arr.push({label:BoxDirection.HORIZONTAL});
- arr.push({label:BoxDirection.VERTICAL});
- comboBox.dataProvider = arr;
- }
- private function comboBox_change(evt:ListEvent):void {
- box.direction = comboBox.selectedLabel;
- }
- ]]>
- </mx:Script>
- <mx:ApplicationControlBardock="true">
- <mx:FormstyleName="plain">
- <mx:FormItemlabel="direction:">
- <mx:ComboBoxid="comboBox"
- initialize="comboBox_init();"
- change="comboBox_change(event);"/>
- </mx:FormItem>
- </mx:Form>
- </mx:ApplicationControlBar>
- <mx:Boxid="box" direction="horizontal" styleName="myBox">
- <mx:Imagesource="Button.png" toolTip="Button" />
- <mx:Imagesource="ButtonBar.png" toolTip="ButtonBar" />
- <mx:Imagesource="CheckBox.png" toolTip="CheckBox" />
- <mx:Imagesource="ColorPicker.png" toolTip="ColorPicker" />
- <mx:Imagesource="ComboBox.png" toolTip="ComboBox" />
- </mx:Box>
- </mx:Application>
本文介绍了一个使用Flex布局的Flash应用程序示例,通过ComboBox选择水平或垂直布局并实时更新Box容器内的Image组件排列方式。该应用展示了如何利用Flex框架实现响应式界面设计。
1050

被折叠的 条评论
为什么被折叠?



