quick dumb flash question
- Started
- Last post
- 8 Responses
- tonks
I just want to create a quick number counting effect to a certain number. I've set up a text field and I just need a bit of code that for example counts up to 34% or 67%... Not a preloader, but just so I can get the effect for animation purposes... obviously I dont want to type ever sinlge number along the timeline. Thankyou please.
- ********0
1st frame:
number == 0
2nd Frame:
number new == number +1
3rd Frame:
gotoAndPlay(2)
//number new is the name of your dynamic text box variable
- tonks0
ahhh - a speedy response for a speedy job. I thankyou sir.
- ********0
Kuz, yesterday ye hud fever today yer oan fire!
- ********0
I'm OD'ing on Flu tablets in the hope i'll be up for the london drinks tonight. Not looking to promising, i'm breaking out in cold sweats and shit. I shoulda taken the day off.
- ********0
Aww shit Kuz, check ya mail - ah've goat summit tae cheer ye up!
- tGP0
try this (it will allow you to set an initial count-from number, and a count to number)... play with movie frame rate, or with stretching the frames apart to make the timeline slower to run the iteration:
// frame 1 code //
// frame 1 code
var max_number = 5000;
// set current number to what you want to count to start from
var current_number = 0;// frame 2 code //
if (current_number < max_number) {
current_number++;
output_txt.text = current_number;
trace("added one");
} else {
this.gotoAndStop(4);
}// frame 3 code //
gotoAndPlay(2);// frame 4 code //
stop();cheers.
j
- tGP0
where "output_txt" is the instance name of your text field...
- ********0
woops, yes you definitly need an if command, otherwise you'll be looping forever incrementing numbers