AS3: Minutes to Milliseconds Helper


/ Published in: ActionScript 3
Save to your folder(s)

Quick little helper method that allows you to no longer think in Milliseconds


Copy this code and paste it in your HTML
  1. var fifteenMinutes:Number = minutesToMilliSecs( 15 );
  2.  
  3. var timer = new Timer( fifteenMinutes );
  4. timer.addEventListener(TimerEvent.TIMER, timerHandler, false, 0, true );
  5. timer.start();
  6.  
  7. private function minutesToMilliSecs( mins:Number ):Number
  8. {
  9. var milliSecs:Number = mins * 60 * 1000;
  10. return milliSecs;
  11. }
  12.  
  13. private function timerHandler( e:TimerEvent ):void
  14. {
  15. trace( "timerHandler:" )
  16. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.