Applying styles to Alert Box.[To every Alert Box and to a particular Alert Box]

The default style of Alert box in flex is dull in color ,so to change it we have to use the following code.

<mx:Style>
Alert
{
backgroundAlpha: 0.3;
backgroundColor: black;
borderAlpha: 0.3;
borderColor: white;
dropShadowEnabled: false;
}
</mx:Style>

This will apply style to every Alert box in the Flex app, so to apply style to a particularAlert Box the below code will help.

<mx:Script>
<![CDATA[

var alert:Alert;
alert=Alert.show(“kumar Gandhi”,”my Style”);
alert.styleName=”myalertstyle”;

]]>
</mx:Script>

<mx:Style>
.myalertstyle
{
backgroundAlpha: 0.3;
backgroundColor: black;
borderAlpha: 0.3;
borderColor: white;
dropShadowEnabled: false;
}
</mx:Style>

This will give colorfull Alert Box in flex app which will defenetily define  RIA.

3 Responses to Applying styles to Alert Box.[To every Alert Box and to a particular Alert Box]

  1. Ram says:

    Hi,
    Is there any way to add a global effect to Alert box so that i can customise the way the alert box appears in my application. PS: For Tool tip we can handle the global effect by using “ToolTipMangaer.showEffect “. LIkewise do we have any for Alert Box ?

  2. kumargandhi says:

    Hi Ram,
    i didn’t work on that actually, i will make a comment here once i get it.

    regards,
    kumar.

  3. […] have this code, but the style is not being applied. I’ve seen articles on the web where this should work. Any […]

Leave a comment