raksmen raksmen - 1 year ago 126
HTML Question

Text width on an alert box in Flex

I have an alert box in flex which looks like this:

enter image description here

I want to increase the width of the text within the alert, to make it look more clean. The 'updated' word should be on the same line and not a new line. I have tried using the style tags

.alertMessage {
letterSpacing: 0;
fontSize: 10;
fontWeight: normal;
color: black;


But it doesn't seem to work. When I used a.width = 400 it just increases the size of the alert box, but the text remains as it is shown in the image.


var a:Alert = Alert.show(message,"Results");
a.mx_internal::alertForm.mx_internal::textField.htmlText = message;

Answer Source

This might be a dirty solution... but anyway I solved it by setting long characters to title. The width is determined by the title or the AlertForm.
So, I added the half space characters to end of "Results".

this is my code

var msg: String = "Splits:(Success: 1 requests; 0 added; 0 updated)\nDividends:(success: 1 requests; 0 added; 1 updated)";
var arr: Array = msg.split("\n");
var maxLength:int = 0;
for (var i:int=0; i<arr.length; i++){
    if (arr[i].toString().length > maxLength){
        maxLength = arr[i].toString().length;
var title: String = "Results";
// the 7 is length of "Results".
for (var j:int=0; j<maxLength-7; j++){
    // Add half space characters.
    title+=" ";

Alert.show(msg, title);

enter image description here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download