astralaaron Posted August 8, 2011 Share Posted August 8, 2011 (edited) I am trying to count seconds / milliseconds and display it like 1.11.21.31.41.51.61.71.81.92.02.1etc.... 10.1etc..20.120.2because I am trying to clock how fast someone is typing but seconds are not a small enough unit to measure with. thanks for any help Edited August 8, 2011 by astralaaron Link to comment Share on other sites More sharing options...
astralaaron Posted August 8, 2011 Author Share Posted August 8, 2011 This is probably the dumbest of all of the ways you could possibly make this happen but it seems to be working so farvar timer:Timer = new Timer(100, 6000);timer.addEventListener(TimerEvent.TIMER, countup);timer.start();function countup(event:TimerEvent) {var totalcount:int = timer.currentCount; if(totalcount < 10) { myText.text = String(totalcount); } else if ((totalcount > 10) && (totalcount < 100)) { myText.text = String(totalcount).substr(0,1) + "." + String(totalcount).substr(1,1); } else if ((totalcount > 100) && (totalcount < 1000)) { myText.text = String(totalcount).substr(0,2) + "." + String(totalcount).substr(2,2); } else if ((totalcount > 1000) && (totalcount < 10000)) { myText.text = String(totalcount).substr(0,3) + "." + String(totalcount).substr(3,3); } else if ((totalcount > 10000) && (totalcount < 100000)) { myText.text = String(totalcount).substr(0,4) + "." + String(totalcount).substr(4,4); }} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now