Highlighted

Help with countdown timer to goto and stop

New Here ,
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

67

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

Help with countdown timer to goto and stop

New Here ,
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

68

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

Copy link to clipboard

Copied

better you post your issue on Actionscript 3 forum

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...
Jul 04, 2019 0