宜昌本地软件开发与弱电工程服务商
项目咨询 · 快速响应
您当前的位置: > 博客2 > AS2与AS3技术

[AS3]as3处理时间间隔的源代码实例

2016-10-13 00:16:48 点击量:11 标签: 收藏本文

日期值在内部以毫秒形式保存,日期时间的加减运算可以换算成毫秒再加减。

  1. package   
  2.  {  
  3.  import flash.display.Sprite;  
  4.  import flash.events.TimerEvent;  
  5.  import flash.utils.Timer;  
  6.   
  7.   public class ShortTimer extends Sprite  
  8.   {  
  9.       public function ShortTimer()   
  10.       {  
  11.           // creates a new five-second Timer  
  12.           var minuteTimer:Timer = new Timer(1000, 5);  
  13.          
  14.           // designates listeners for the interval and completion events  
  15.           minuteTimer.addEventListener(TimerEvent.TIMER, onTick); 
  16.           minuteTimer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete); 
  17.          
  18.           // starts the timer ticking  
  19.           minuteTimer.start(); 
  20.        }  
  21.   
  22.   public function onTick(event:TimerEvent):void   
  23.     {  
  24.       // displays the tick count so far  
  25.       // The target of this event is the Timer instance itself.  
  26.       trace("tick " + event.target.currentCount);  
  27.     }  
  28.   
  29.   public function onTimerComplete(event:TimerEvent):void  
  30.   {  
  31.          trace("CuPlayer.com act: Time's Up!");  
  32.   }  
  33.  } 

 

ABOUT US
宜昌农人网络科技有限公司

我们是一家提供综合软件外包与弱电工程服务的技术公司。

业务涵盖定制软件、管理系统、网站、小程序、APP、系统集成、网络布线、监控安防、门禁、机房建设及长期技术维护。

公司地址:湖北省宜昌市伍家岗区东站二路6号三峡(宜昌)大数据产业园海洋馆二楼A203室