Hi,
Can't figure out how to put ":" in between a 3 digit number that has been calculated in a function.
Ex.
I want to make this--> "100", into this--> "1:00"
Thanks!
Spit
Forgot to say I'm using CS3 and AS2.
Printable View
Hi,
Can't figure out how to put ":" in between a 3 digit number that has been calculated in a function.
Ex.
I want to make this--> "100", into this--> "1:00"
Thanks!
Spit
Forgot to say I'm using CS3 and AS2.
use the substr() method. It takes 1 required argument and a 2nd optional argument. The 1st is where in the string to start cutting and the 2nd is how far to cut. If you don't supply the 2nd, it assumes you want the rest of the string.
Actionscript Code:var firstHalf:String = String(100).substr(0,1);
var secondHalf:String = String(100).substr(1);
trace(firstHalf + ":" + secondHalf);
Got it working perfect in my project!
Thank You! :)