Highlighted

I need sum help with timer i am making

Community Beginner ,
Mar 05, 2019

Copy link to clipboard

Copied

I have a timer I got it working fine counting up but I need to get it to countdown from 05:00 to 0 any help I would appreciate it

import flash.utils.Timer;

import flash.events.TimerEvent;

var mytimer:Timer = new Timer(1000,300);

var i:Number = 0;

myText.text = "00:00"

mytimer.addEventListener(TimerEvent.TIMER, timerHandler);

mytimer.start();

function timerHandler(event:TimerEvent){

  i++;

  var totalSeconds:* =i;

  var minutes:* = Math.floor(totalSeconds/60);

  var seconds:* = totalSeconds % 60;

   if(String(minutes).length < 2)

   minutes = "0" + minutes;

if(String(seconds).length < 2)

      seconds = "0" + seconds;

myText.text = minutes + ":" + seconds;

TOPICS
ActionScript

Views

222

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

I need sum help with timer i am making

Community Beginner ,
Mar 05, 2019

Copy link to clipboard

Copied

I have a timer I got it working fine counting up but I need to get it to countdown from 05:00 to 0 any help I would appreciate it

import flash.utils.Timer;

import flash.events.TimerEvent;

var mytimer:Timer = new Timer(1000,300);

var i:Number = 0;

myText.text = "00:00"

mytimer.addEventListener(TimerEvent.TIMER, timerHandler);

mytimer.start();

function timerHandler(event:TimerEvent){

  i++;

  var totalSeconds:* =i;

  var minutes:* = Math.floor(totalSeconds/60);

  var seconds:* = totalSeconds % 60;

   if(String(minutes).length < 2)

   minutes = "0" + minutes;

if(String(seconds).length < 2)

      seconds = "0" + seconds;

myText.text = minutes + ":" + seconds;

TOPICS
ActionScript

Views

223

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Mar 05, 2019 0
LEGEND ,
Mar 05, 2019

Copy link to clipboard

Copied

Try searching Google using "AS3 countdown timer" and see what you find

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 05, 2019 0
Adobe Community Professional ,
Mar 05, 2019

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Mar 05, 2019 0