This is my 2-part question. My understanding is small so "beer" with me.
This example counts from 1-100. I want the decimal keep counting to ten over-and over. (a.)How do I loop the decimal? 1-10 over-and-over. (b.)How to I get the whole and decimal value on the same dynamic text field?
alt text http://www.ashcraftband.com/myspace/videodnd/icon9.jpg
THING
"It's a counter with whole and decimal values"
-text filed receive string of whole number and decimal place
-decimal fast, whole number slow
CODE
/*I made two text fields, change the names and values, but the values didn't
respond properly. 1000 = 1 sec and 100 = 1/10th or a second. The whole thing changed.*/
//working code
var timer:Timer = new Timer(1000, 100);
timer.addEventListener(TimerEvent.TIMER, countdown);
timer.start();
function countdown(event:TimerEvent) {
myText.text = String(0 + timer.currentCount);
}
IDEAS
(a.)
//RESET START
function countdown($evt:TimerEvent):void {
timer.reset();
timer.start();
VERBOSE EXAMPLE
if Number's less than 11, do it again
(b.)
//STRING
var time:String =whole + ":" + decimal;
time_txt.text = countdown;
UNEXPECTED PROBLEMS
-changing values (1000, 100) didn't work "affects the other number"
-I don't know how I'm going to add velocity to something in the timer class "an other post"
alt text http://www.ashcraftband.com/myspace/videodnd/icon_1.jpg
THE DECIMALS STAY IN THEIR PLACE
//CA, NC, LONDON
var timer:Timer = new Timer(10);
var count:int = 0; //start at -1 if you want the first decimal to be 0
var fcount:int = 0;
timer.addEventListener(TimerEvent.TIMER, incrementCounter);
timer.start();
function incrementCounter(event:TimerEvent) {
count++;
var whole_value:int = int(count / 100); //change value
var tenths:int = int(count / 10) % 10;
var hundredths:int = int(count) % 10;
mytext.text = whole_value + " : " + tenths + hundredths;
}
CRITERIA "I forgot to include 2/10/10"
WHOLES
X 10 multiples
DECIMALS
tenths dec = 10% of ones
hundreds dec = 10% of tenths dec
"thanks for the help everyone"