flex定时器

<?xml version="1.0" encoding="utf-8"?>
<!-- http://blog.flexexamples.com/2008/02/15/creating-timers-using-the-settimeout-method/ -->
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white">
     <mx:Script>
         <![CDATA[
             import mx.controls.Alert;
             private var alert:Alert;
             private function delayedAlert():void {
                 var num:Number;
                 flash.utils.setTimeout(launchAlert, 2000);
                 button.enabled = false;
             }
             private function launchAlert():void {
                 alert = Alert.show("I'm an alert.");
                 button.enabled = true;
             }
         ]]>
     </mx:Script>
    <mx:Button id="button"
            label="Click here to launch alert (2 second delay)"
            click="delayedAlert();" />
</mx:Application>

    A+
发布日期:2009年11月28日  所属分类:未分类

发表评论

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