View Full Version : Count up
shine
08-19-2009, 12:50 PM
Hi
I want to count from 0 - 95. I found this thread but i canīt cange the font, size or alignment.
http://www.actionscript.org/forums/showthread.php3?t=116768
Looks like the script creates a textfield by its own?
Help anyone?
Best regards
Sofia
I found this thread but i canīt cange the font, size or alignment. Looks like the script creates a textfield by its own?
In any of those examples from that thread you can remove the "createTextField" code and manually create a textfield on stage and just give it the proper instance name (as referenced in the code) depending on which code you use from that thread. Or you could code the font, size, alignment all via actionscript also. Either way should work fine.
shine
08-19-2009, 01:46 PM
Hi asf8
Im a newbie so i understand the code but i donīt know how to write..
Can you help me? I would like to manually create a textfield on stage and just give it the proper instance name.
var tf:TextField = this.createTextField('counter', this.getNextHighestDepth(), 10, 10, 300, 22);
In this example the instance name would be - tf
http://www.actionscript.org/forums/showpost.php3?p=532864&postcount=2
In this example the instance name would be - txt
http://www.actionscript.org/forums/showpost.php3?p=533437&postcount=4
In these examples the instance name would be - dt
http://www.actionscript.org/forums/showpost.php3?p=689371&postcount=9
http://www.actionscript.org/forums/showpost.php3?p=689376&postcount=11
Basically you can look at the code and see: someReference.text either used within an onEnterFrame or an setInterval and that is the textfield reference the code is using. So you can remove the createTextField lines from each and manually create a textfield on stage with those references listed above. Likewise you can change them to another name if you like, you would just need to make sure you replace all references to the new name.
Make sense? Help?
shine
08-19-2009, 03:02 PM
Like this then :)
var startT:Number = 0;
var endT:Number = 115;
onEnterFrame = function () {
if (startT >= endT)
{
delete onEnterFrame;
tf.text = String(endT);
}
else
{
tf.text = String(startT);
startT += 5;
}
}
Can I contoll the speed some how?
Can I contoll the speed some how?
How fast it counts up?
You could adjust the increment it uses to increase...
// this line in the above code..
startT += 5; // change 5 to a higher number
If that's whats you mean.
shine
08-19-2009, 03:18 PM
hmm no, i mean the speed of changing numbers.
hmm no, i mean the speed of changing numbers.
Doesn't that decrease the speed it takes to reach the endT? By increasing the steps it will decrease the steps needed thus making it reach the end faster. The other option is to increase the frame rate of your SWF. Or switch to using one of the setInterval examples (http://www.actionscript.org/forums/showpost.php3?p=689371&postcount=9) from the same thread and play with the interval number to your liking.
i understand the code
I still confused about this comment :p
|
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.