白鹭引擎定时器代码实例

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/hj960511/article/details/82286575

白鹭引擎
版本:5.2.8
描述:实现定时器操作代码实例

全局声明

private timer:egret.Timer;
private num;

函数中使用的代码片段

    ptivate fun_num(){

        this.timer = new egret.Timer(1000, 0);
        this.timer.addEventListener(egret.TimerEvent.TIMER, this.director, this);

    }
    private director(){

        num++;
        console.log('运行次数:'+num);

    }

猜你喜欢

转载自blog.csdn.net/hj960511/article/details/82286575