This did it:

main MXML all script:

import mx.managers.PopUpManager;
import mx.controls.Alert;


public function show(messageItem:String): void
 {
        
        var alertInstance:alertPopupDialog =
    alertPopupDialog(PopUpManager.createPopUp(this,
    alertPopupDialog,
    true));     //instantiate and show the title window

        PopUpManager.centerPopUp(alertInstance);
        alertInstance.messageString = messageItem;
        
        
 }

titleWindow MXML component

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute" width="596" height="134" title="Attention:"
titleIcon="@Embed(source='/images/alarmicon.png')"
styleName="alertStyle" creationComplete="setTimer();">
        <mx:Style>
                
                .alertStyle {
                font-family: Verdana;
                flashType: true;
                font-weight: normal;
                color: #000000;
                font-size: 18pt;
                background-color: #FF9999;
                border-color: #FF9999;
                roundedBottomCorners: true;
                cornerRadius: 15;
                borderStyle: solid;
        }
                
        </mx:Style>
        <mx:Script>
                <![CDATA[
                        
                        import flash.utils.Timer;
                        import mx.managers.PopUpManager;
                        public var timer:Timer;
                        
                        [Bindable]
                public var messageString:String; 
                
                private function setTimer():void
                {
                        timer = new Timer(5000, 1);
                                timer.addEventListener(TimerEvent.TIMER, 
onTimer);
                                if (timer.running)
                                        {
                                                timer.stop();
                                        }
                                timer.start();
                }
                        
                        public function onTimer(event : TimerEvent):void
                        {
                                timer.removeEventListener(TimerEvent.TIMER, 
onTimer);
                                PopUpManager.removePopUp(this);
                        }
                        
                ]]>
        </mx:Script>
        <mx:Label x="10" y="30" textAlign="left" fontSize="18"
id="alertMessage" text="{messageString}"/>

</mx:TitleWindow>


Reply via email to