小编Ric*_*ook的帖子

定时器不会重置

嘿伙计,所以我有一个工作的Timer,当我调用它并启动时会停止(),但我不能让它重置().它只是从它停止的地方开始.

计时器的代码

package 
{

    import flash.display.MovieClip;
    import flash.display.Stage;
    import flash.text.TextField;
    import flash.events.Event;
    import flash.utils.Timer;
    import flash.events.TimerEvent;


    public class Score extends MovieClip
    {
        public var second:Number = 0;
        public var timer:Timer = new Timer(100);
        private var stageRef:Stage;
        private var endScore:displayFinalScore;

        public function Score(stageRef:Stage)
        {
            x = 560.95;
            y = 31.35;
            this.stageRef = stageRef;
            this.endScore = endScore;

            timer.addEventListener(TimerEvent.TIMER, scoreTimer);
            timer.reset();
            timer.start();
            updateDisplay();


        }

        public function scoreTimer(evt:TimerEvent):void
        {

            second += 1;
            updateDisplay();
        }

        public function get10Points(points:Number) : void
        {
            second += points;
            updateDisplay(); …
Run Code Online (Sandbox Code Playgroud)

flash actionscript-3

2
推荐指数
1
解决办法
5292
查看次数

标签 统计

actionscript-3 ×1

flash ×1