R – Flex 3 Alert text doesn’t stretch to fill space

actionscript-3apache-flex

This seems like a ridiculously simple question, and yet I just can't seem to find an answer.

I'm trying to display some simple information in an Alert (I'd rather not use an alert, but I need a fast n' simple solution for a project that's got to be out the door asap)

Long story short, no matter how large I make the alert, my information never stretches out, and ends up being clipped.

I can actually scroll through the text with the mousewheel, but that's no good.

The image says it all. Any ideas how to get around this? I can't imagine Alert just doesn't handle this.

Image here:

http://img196.imageshack.us/img196/3/bigalert.png

(I'm still a new user, can cannot add it directly)

Code:

var myAlert:Alert = Alert.show("The package you have selected includes a feature(s) you’ve already selected. \nWe have removed the individual features for you.");
myAlert.height = 150*2;
myAlert.width = 350*2;

Best Answer

Quick and dirty solution.

import mx.core.mx_internal;
use namespace mx_internal;

private function showAlert():void {
    var myAlert:Alert = Alert.show("The package you have selected includes a feature(s) you’ve already selected. \nWe have removed the individual features for you.");
    myAlert.height = 150*2;
    myAlert.width = 350*2;
    callLater(function():void {
        var textField:IUITextField =  IUITextField(myAlert.mx_internal::alertForm.mx_internal::textField);

        var textFormat:TextFormat = new TextFormat();
        textFormat.align = "center";

        textField.width = myAlert.width;
        textField.x = 0;
        textField.setTextFormat(textFormat);
    });
}
Related Topic