您的位置:首页 > 编程语言 > VB

Flex中如何通过direction属性,改变Box容器(HBox或VBox)方向

2009-06-08 23:50 495 查看
main.mxml

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns: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:ApplicationControlBar dock="true">

<mx:Form styleName="plain">

<mx:FormItem label="direction:">

<mx:ComboBox id="comboBox"

initialize="comboBox_init();"

change="comboBox_change(event);" />

</mx:FormItem>

</mx:Form>

</mx:ApplicationControlBar>



<mx:Box id="box" direction="horizontal" styleName="myBox">

<mx:Image source="Button.png" toolTip="Button" />

<mx:Image source="ButtonBar.png" toolTip="ButtonBar" />

<mx:Image source="CheckBox.png" toolTip="CheckBox" />

<mx:Image source="ColorPicker.png" toolTip="ColorPicker" />

<mx:Image source="ComboBox.png" toolTip="ComboBox" />

</mx:Box>



</mx:Application>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐