In this code example, how can I remove the PopUp please? (I know what
I have is currently incorrect):

<?xml version="1.0" encoding="utf-8"?>

<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
layout="absolute">
        <mx:Script>
        <![CDATA[

import mx.managers.PopUpManager;
import mx.controls.Alert;
import flash.utils.Timer;

public var timer:Timer;



public function show(messageItem:String): void
 {
        timer = new Timer(3, 1);
        timer.addEventListener(TimerEvent.TIMER, onTimer);
        var alertInstance:alertPopupDialog =
    alertPopupDialog(PopUpManager.createPopUp(this,
    alertPopupDialog,
    true));     //instantiate and show the title window

        PopUpManager.centerPopUp(alertInstance);
        alertInstance.messageString = messageItem;
        
        if (timer.running)
                {
                        timer.stop();
                }
        timer.start();
 }

private function onTimer(event : TimerEvent):void
 {
                PopUpManager.removePopUp(alertInstance);
                timer.removeEventListener(TimerEvent.TIMER, onTimer);
 }


        ]]>
</mx:Script>
        <mx:Button x="201" y="221" label="Try it!" click="show('Here is a
message');"/>
        
</mx:Application>


Reply via email to