<fx:Script>
private function showSuccessDialog(msg:String):void
{
var label:Label = new Label();
label.text = msg;
label.width = 290;
label.x = 20;
label.y = 30;
var btnok:Button = new Button();
btnok.label = "OK";
btnok.width = 100;
btnok.x = 100;
btnok.y = label.y + 30;
titleWindow = new TitleWindow();
titleWindow.title = "Success";
titleWindow.width = 300;
//when i add this two elements label and button both are displayed on same position
//my label size increases dynamically so i want to add that button below that label
//here for titleWindow i want to set layout how i can do that
titleWindow.addElement(label);
titleWindow.addElement(btnok);
PopUpManager.addPopUp(titleWindow, this, true);
PopUpManager.centerPopUp(titleWindow);
}
</fx:Script>
答案 0 :(得分:5)
假设你正在使用FX这是一个Spark TitleWindow:
titleWindow.layout = new VerticalLayout();
然后您可以像这样设置布局属性
(tw.layout as VerticalLayout).gap = 4; //sets the gap between items
(tw.layout as VerticalLayout).paddingLeft = 10; //sets the left padding
等