flex中自动消失的alert框

cool.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">
 
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.managers.PopUpManager;
 
            private var alert:Alert;
 
            private function showAndHide(delay:Number):void {
                var alertText:String = "I'm an Alert control. I'll disappear in " + (delay / 1000).toFixed(1) + " seconds.";
                var alertTitle:String = "Timed Alert";
                alert = Alert.show(alertText, alertTitle);
                setTimeout(hideAlert, delay);
            }
 
            private function hideAlert():void {
                PopUpManager.removePopUp(alert);
            }
        ]]>
    </mx:Script>
 
    <mx:ApplicationControlBar dock="true">
        <mx:Button label="Launch alert"
                click="showAndHide(3000);" />
    </mx:ApplicationControlBar>
 
</mx:Application>

    A+
发布日期:2009年12月13日  所属分类:未分类

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: