sawan
sawan

Reputation: 2381

How to set layout to titleWindow in flex?

<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>

Upvotes: 1

Views: 1840

Answers (1)

Jonathan Rowny
Jonathan Rowny

Reputation: 7588

Assuming since you're using FX that this is a spark TitleWindow:

titleWindow.layout = new VerticalLayout();

You can then set layout properties like this

(tw.layout as VerticalLayout).gap = 4; //sets the gap between items
(tw.layout as VerticalLayout).paddingLeft = 10;  //sets the left padding

etc.

Upvotes: 5

Related Questions