tags:

views:

121

answers:

2

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

+1  A: 

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.

Prutswonder
A: 

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

rajat