A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: Football Timer!!! any one have a AS3 code?

  1. #1
    Registered User
    Join Date
    Jun 2019
    Posts
    2

    Football Timer!!! any one have a AS3 code?

    I'm working on a Football score bug for low budget sports coverage and using Animate CC almost all the elements were done but the "Timer". Need to start st 0:0 and up to 45:00+ for the first half and start at 45:00 and end at 90:00+. Anyone knows code for this? Thanks!

  2. #2
    Senior Member
    Join Date
    Feb 2005
    Posts
    1,834
    Here are 2 different pieces of code. 1st is the timer code. It's best to use the Timer class for this type of thing. It'll track time properly. 2nd is the formatting code. I added it just for convenience. Do you need any further help to transform this to what you want? You'll mainly need to start/stop the timer based upon myTimer.currentCount. That count is for seconds.
    Code:
    //Timer code:
    var myTimer:Timer = new Timer(1000);
    myTimer.addEventListener(TimerEvent.TIMER, timerListener);
    function timerListener(e:TimerEvent):void {
    	time.text = formatTime(myTimer.currentCount);
    }
    myTimer.start();
    //Formatting code:
    function formatTime(input:int):String {
    	var hrs:String = (input > 3600 ? Math.floor(input / 3600) + ':' : '');
    	var mins:String = (hrs && input % 3600 < 600 ? '0' : '') + Math.floor(input % 3600 / 60) + ':';
    	var secs:String = (input % 60 < 10 ? '0' : '') + input % 60;
    	return hrs + mins + secs;
    }
    .

  3. #3
    Registered User
    Join Date
    Jun 2019
    Posts
    2
    Thanks!!, hope this would complete our local broadcast coverage. I would be willing to help you back in some other way

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center