我有一个表单,里面有一个按钮Onclick,我正在动态地向表单添加组件。我已成功将组件添加到表单中。我添加了一个小组来鼓励他们并给予调整。如何将水平布局添加到s:Group。
protected function ADD_CVE_ID_clickHandler(event:MouseEvent):void
{
var textinput:TextInput = new TextInput;
var dropdown:DropDownList = new DropDownList;
var textArea:TextArea = new TextArea;
var Grouptest:Group = new Group;
Grouptest.addElement(textinput);
Grouptest.addElement(dropdown);
Grouptest.addElement(textArea);
AddHere.addElement(Grouptest);
}
答案 0 :(得分:1)
根据您的要求使用以下代码: -
protected function ADD_CVE_ID_clickHandler(event:MouseEvent):void
{
var textinput:TextInput = new TextInput();
var dropdown:DropDownList = new DropDownList();
var textArea:TextArea = new TextArea();
var Grouptest:Group = new Group();
var horizontalLayout:HorizontalLayout = new HorizontalLayout();
Grouptest.layout = horizontalLayout;
Grouptest.addElement(textinput);
Grouptest.addElement(dropdown);
Grouptest.addElement(textArea);
AddHere.addElement(Grouptest);
}