Flex/Actionscript定时Timer实践运用
来源:互联网 发布:hishop移动云商城源码 编辑:程序博客网 时间:2024/06/10 16:23
来自help.adobe.com:
The Timer class is the interface to timers, which let you run code on a specified time sequence. Use the start() method to start a timer. Add an event listener for the timer event to set up code to be run on the timer interval.
运用它的关键地方:
1. 首先定义好timer对象
public var _timer:Timer = new Timer(3000, 1);/*定时3秒钟, 重复1次*/
timer对象的构造方法:
public function Timer(delay:Number, repeatCount:int = 0)
两个参数,delay:间隔时间单位为微妙,或是等待时间;repeatCount:重复次数,即指定timer计时器要作用几次。
repeatCount默认情况为0,可以无限次的使用,除非调用_timer.stop()。
2. 给timer对象新增事件监听,即时间到了要干的活
_timer.addEventListener(TimerEvent.TIMER, _onTimer);
private function _onTimer(e:TimerEvent):void
{
//add your statements
}
3.之前两步是准备好所有的“作料”,下面是如何控制
1)什么时候“按表”:_timer.start();
2)什么时候“归零”:_timer.reset();
3) 提前“停表”:_timer.stop();
正常的过程是start之后,设定的时间到了就触发_onTimer干活;
- Flex/Actionscript定时Timer实践运用
- Flex实践—ActionScript函数功能
- ActionScript运用
- actionScript 使用timer
- Flex ActionScript Language Reference
- Using ActionScript in Flex
- Flex/ActionScript logging
- flex 创建ActionScript组件
- Flex和Actionscript
- Flex使用ActionScript
- [Flex 2] 03 ActionScript
- flex基础 actionscript
- flex 解析 json actionscript
- Flex ActionScript Demo
- Flex学习 ActionScript & mxml
- flex actionscript时间处理
- flex actionScript时间处理
- flex actionScript读取文件
- linux 查看命令帮助
- ubuntu 桌面上添加回收站
- pbsk browser
- Visual Studio 单元测试 C++ 版 —— 测试已有的工程
- flex 如何获取datagrid中cell的数据
- Flex/Actionscript定时Timer实践运用
- HTML 5 form属性支持
- VS 2010 【LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏】
- 常用的js函数方法
- oracle学习笔记——1
- table设计模式
- css之margin collapse(外边距叠加)
- 编程语言学习之我见
- lite version是什么