• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Help with countdown timer to goto and stop

Community Beginner ,
Jul 04, 2019 Jul 04, 2019

Copy link to clipboard

Copied

Hi I need help adding a go to and stop at frame function  to the end of this countdown script

I've tried making a script of code but keep failing. Please help

countDown1F(00,50,50000,tf1);

function countDown2F(nStart:int,nEnd:int,duration:uint,tf:TextField) {

  if (nStart>=nEnd) {

  return null;

  } else {

  var t:Timer = new Timer(duration/(nEnd-nStart),nEnd-nStart);

t.addEventListener(TimerEvent.TIMER,function(e:TimerEvent){f2(e,nEnd,tf)});

  t.dispatchEvent(new TimerEvent(TimerEvent.TIMER));

  t.start();

  }

}

function f2(e:TimerEvent,nEnd:int,tf:TextField){

  

}

function countDown1F(nStart:int,nEnd:int,duration:uint,tf:TextField) {

  if (nStart>=nEnd) {

  return null;

  } else {

  var t:Timer = new Timer(duration/(nEnd-nStart),nEnd-nStart);

t.addEventListener(TimerEvent.TIMER,function(e:TimerEvent){f1(e,nEnd,tf)});

  t.dispatchEvent(new TimerEvent(TimerEvent.TIMER));

  t.start();

  }

}

function f1(e:TimerEvent,nEnd:int,tf:TextField){

  tf.text = formatF( (nEnd-e.target.currentCount));

}

function formatF(n:int):String {

var min:int = Math.floor(n/60);

var sec:int = n-min*60;

var a:Array = [min.toString(),sec.toString()];

for (var i:uint=0; i<a.length; i++) {

  while (a.length<2) {

  a="0"+a;

  }

}

return a[0] + ":" + a[1];

}

TOPICS
ActionScript

Views

145

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
community guidelines
Advisor ,
Jul 04, 2019 Jul 04, 2019

Copy link to clipboard

Copied

LATEST

better you post your issue on Actionscript 3 forum

Votes

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
community guidelines