[AS3]as3中添加运行每一帧和计时监听事件源代码实例
[AS3]as3中添加运行每一帧和计时监听事件源代码实例
[AS3]as3中添加运行每一帧和计时监听事件源代码实例
- package {
- import flash.display.Sprite;
- import flash.events.Event;
- import flash.events.TimerEvent;
- import flash.utils.Timer;
- public class ExampleApplication extends Sprite {
- private var _sprite:Sprite;
- private var _sprite1:Sprite;
- private var t:Timer;
- public function ExampleApplication( ) {
- _sprite=new Sprite();
- addChild(_sprite);
- _sprite.x=275;
- _sprite.y=200;
- _sprite.graphics.lineStyle(2, 0x990000, 1);
- _sprite.graphics.lineTo(0, 150);
- addEventListener(Event.ENTER_FRAME, gx);
- t=new Timer(1000,10);
- t.start();
- _sprite1=new Sprite();
- addChild(_sprite1);
- _sprite1.x=275;
- _sprite1.y=200;
- _sprite1.graphics.lineStyle(2, 0x009966, 1);
- _sprite1.graphics.lineTo(0, 100);
- t.addEventListener(TimerEvent.TIMER, s);
- t.addEventListener(TimerEvent.TIMER_COMPLETE,wc);
- }
- private function gx(event:Event):void {
- _sprite.rotation+=1;
- }
- private function s(event:TimerEvent):void {
- _sprite1.rotation+=1;
- }
- private function wc(event:TimerEvent):void {
- t.stop();
- trace(t.currentCount)//
- removeEventListener(Event.ENTER_FRAME, gx);
- }
- }
- }
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...