我需要在表单上使用水平布局,它们看起来像这样:
<mx:Form id="myForm" width="100%">
<mx:FormItem label="Color">
<s:ComboBox id="color">
<s:dataProvider>
<mx:ArrayList>
<fx:String>Red</fx:String>
<fx:String>Orange</fx:String>
<fx:String>Yellow</fx:String>
<fx:String>Blue</fx:String>
<fx:String>Green</fx:String>
</mx:ArrayList>
</s:dataProvider>
</s:ComboBox>
</mx:FormItem>
</mx:Form>
我对新的Flex 4架构非常困惑......
答案 0 :(得分:2)
默认情况下,Form
组件将始终垂直布置其子项。如果您想要水平布局,则必须扩展Form
类。试试这个:
<强> HorizontalForm.as 强>
package
{
import mx.containers.BoxDirection;
import mx.containers.Form;
import mx.core.mx_internal;
public class HorizontalForm extends Form
{
public function HorizontalForm()
{
super();
mx_internal::layoutObject.direction = BoxDirection.HORIZONTAL;
}
}
}