14
Aug
07

Changing a modal Alert control’s blur, transparency and transparency color

The following example allows you to use Cascading Style Sheets (CSS) to control a Flex Alert control’s modalTransparencyBlur, modalTransparency, modalTransparencyColor, and modalTransparencyDuration styles.

Full code after the jump.

View MXML

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2007/08/14/changing-a-modal-alert-controls-blur-transparency-and-transparency-color/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="showAlert()">

    <mx:Style>
        Alert {
            modalTransparencyBlur: 5;
            modalTransparency: 0.6;
            modalTransparencyColor: #FF0000;
            modalTransparencyDuration: 1000;
        }
    </mx:Style>

    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;

            private var a:Alert;

            private function showAlert():void {
                a = Alert.show("text", "title", Alert.OK);
            }
        ]]>
    </mx:Script>

    <mx:Button label="Show Alert" click="showAlert()" />

</mx:Application>

View source is enabled in the following example.


1 Response to “Changing a modal Alert control's blur, transparency and transparency color”


  1. 1 Campbell Aug 15th, 2007 at 12:01 am

    Or change the class:

    // Setup new mofdal window class for popupManager
    protected function setupOverlay(type:Class):void{
    var ipm:IPopUpManager =Singleton.getInstance(”mx.managers::IPopUpManager”) as PopUpManager;
    var o:Object = ipm;
    var p:QName = new QName(mx_internal, “modalWindowClass”);
    o[p] = type;
    }

    Just make sure the type class reference extends UIComponent :)

    I have been Doing quite a bit with the PopUpManager, and found it way too locked down, which is why I have to step into mx_internal namespace :(

Leave a Reply

This blog is terrible at eating HTML tags. If you plan on posting code/XML, please escape your "<" characters as "&lt;" and your ">" characters as "&gt;".