maniohile
maniohile

Reputation: 43

how to set width and height of alertbox?

I want to set the width and height of alert box ,i tried it by fixing the width and height but showing error ,and also i want to set the width and height as 100% Thank's in advance

Upvotes: 1

Views: 4831

Answers (2)

rajat
rajat

Reputation: 11

myAlert = Alert.show("Are you sure?", "Alert", Alert.OK | Alert.CANCEL);
myAlert.height = 150;
myAlert.width = 150;

Upvotes: 1

Prutswonder
Prutswonder

Reputation: 10064

Try this code (taken from this page):

            myAlert = Alert.show("Are you sure?", "Alert", Alert.OK | Alert.CANCEL);
            myAlert.height = 150;
            myAlert.width = 150;

Keep in mind that alert windows in Flex are not modal, so code written after displaying the dialog is executed immediately. That's why the above sample works. If you want to postpone executing your code until the user responded to the alert, then use event listeners as described here.

I would not recommend setting the width and height to 100%, because that's not the standard behaviour of message boxes. You should set them to a width and height of a maximum of 50% of your application. Larger message boxes will be looked at as pop-up windows and you know what users do with unexpected pop-up windows.

Upvotes: 1

Related Questions