Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex flex-timer在翻滚时启动_Apache Flex_Timer - Fatal编程技术网

Apache flex flex-timer在翻滚时启动

Apache flex flex-timer在翻滚时启动,apache-flex,timer,Apache Flex,Timer,我在flex中的弹出按钮上有一个翻滚事件。我希望菜单在翻滚时打开。但是,如果用户不小心将鼠标放在组件上,则不应显示菜单。所以在滚动时,我想启动一个计时器(等待半秒),然后检查用户是否仍在弹出按钮上(滚动未启动) 到目前为止,我的示例代码是: private function rollOverMenu(event:Event){ rollOutNow = false; var shortDelay:Timer = new T

我在flex中的弹出按钮上有一个翻滚事件。我希望菜单在翻滚时打开。但是,如果用户不小心将鼠标放在组件上,则不应显示菜单。所以在滚动时,我想启动一个计时器(等待半秒),然后检查用户是否仍在弹出按钮上(滚动未启动)

到目前为止,我的示例代码是:

             private function rollOverMenu(event:Event){
            rollOutNow = false;
            var shortDelay:Timer = new Timer(3000);
            shortDelay.addEventListener(TimerEvent.TIMER_COMPLETE, timerCompleteEvent);
            shortDelay.start();
         }

        private function timerCompleteEvent(event:Timer){
            Alert.show("time is up");
            if (!rollOutNow){
                /*open the menu*/
            }
         }

警报“time is up”(时间已到)从未显示,您知道我的计时器事件为何不起作用吗?

是的,但只提供延迟,而不是重复计数,计时器将永远持续,只发送TimerEvent.timer事件


可以监听TimerEvent.TIMER事件,或者让构造函数接受如下参数:new TIMER(3000,1),其中1是重复计数。

u也可以使用类似的参数

on rollover method(): {
// this sleeps for 3000 milliseconds and then call the method functionName.so     
  implement ur functionality inside "functionName"

setTimeout(3000,functionName);
}