惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Schneier on Security
有赞技术团队
有赞技术团队
T
The Blog of Author Tim Ferriss
F
Fortinet All Blogs
D
DataBreaches.Net
F
Full Disclosure
腾讯CDC
博客园 - 【当耐特】
MyScale Blog
MyScale Blog
Stack Overflow Blog
Stack Overflow Blog
小众软件
小众软件
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
爱范儿
爱范儿
The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
大猫的无限游戏
大猫的无限游戏
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
SegmentFault 最新的问题
The Register - Security
The Register - Security
WordPress大学
WordPress大学
博客园 - 聂微东
雷峰网
雷峰网
J
Java Code Geeks
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy International News Feed
酷 壳 – CoolShell
酷 壳 – CoolShell
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cyber Attacks, Cyber Crime and Cyber Security
T
Tor Project blog
博客园 - 三生石上(FineUI控件)
Know Your Adversary
Know Your Adversary
AWS News Blog
AWS News Blog
G
Google Developers Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
CERT Recently Published Vulnerability Notes
O
OpenAI News
Project Zero
Project Zero
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
N
News and Events Feed by Topic
MongoDB | Blog
MongoDB | Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
Cisco Talos Blog
Cisco Talos Blog
P
Palo Alto Networks Blog
Schneier on Security
Schneier on Security

博客园 - 大步前行

destoon的如何显示tag生成的sql语句 今天看到一个关于黄帝内经的消息,祝华英的消息 laravel 代码维护, 使用php artisan使用应用程序处于维护状态 csdn能不靠点谱啊 Laravel4.2取得配置文件值 dwz 取不到 form中的值 无法开始服务器! 服务器执行缺少? thinkphp __PUBLIC__的定义 __ROOT__等常量的定义 树形列表 jqtree数据 使用 图片下载器下载网页内容及网页图片,节省时间 htaccess不起作用的解决方法,AllowOverride All打开后出现403错误时解决办法 好久不做开发了,最近使用vs2008遇到了不能添加多个项目的问题,在此标记一下 看到蘑菇街的注册界面不错,截了个图,发这在里,做个标记 蓝色标题栏div css 如何使用ActionScript来检测用户的语言及屏幕分辨率 如何使用ActionScript来检测用户的操作系统种类及浏览器类型 如何使Flex Builder 3与flash cs4共同工作 在flash中使用arguments数组 flash的运算比较符
flash 的计数器
大步前行 · 2009-05-13 · via 博客园 - 大步前行

计时器的作用:以一定的间隔触发事件.使用Timer可以很方便地创建独立于影片帧速率的动画,使用定时器可以以任意时间为间隔调用方法.

使用enterFrame事件也可以让一些动作定时发生.但是使用定时器事件与使用enterFrame事件最显著的不同在于使用定时器事件是于.swf文件的帧率没有关系的.

使用Timer的时候必须引入的命名空间为:

import flash.events.TimerEvent;

import flash.utils.Timer;

例子:


package
{
    import flash.display.Sprite;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    public class CxyTimer extends Sprite
    {
        private 
var _square:Sprite,_circle:Sprite;
        public 
function CxyTimer()
        {
            _square
=new Sprite();
            _square.graphics.beginFill(
0xff0000);
            _square.graphics.drawRect(
0,0,30,30);
            _square.graphics.endFill();
            addChild(_square);
            _square.x
=100;
            _square.y
=50;
            
            
            
            _circle
=new Sprite();
            _circle.graphics.beginFill(
0x00ff00);
            _circle.graphics.drawEllipse(
80,80,30,30);
            _circle.graphics.endFill();
            addChild(_circle);
            _circle.x
=100;
            _circle.y
=200;
            
            
var _timer:Timer=new Timer(50,30);
            _timer.addEventListener(TimerEvent.TIMER,onTimer);
            _timer.start();
        }
        
        public 
function onTimer(event:TimerEvent):void
        { 
            _square.x
++;
            _circle.y
++;
        }

    }
}