I am using Actionscript 2.0
In a Brand new Scene. My only bit of code is:
trace(int('04755'));
trace(int('04812'));
Results in:
-
2541
-
4812
Any idea what I am doing wrong/silly?
By the way, I am getting this source number from XML, where it already has the leading 0. Also, this works perfect in Actionscript 3.
Converting a string with a leading 0 to a Number in ActionScript 2 assumes that the number you want is octal. Give this function I’ve made for you a try:
Basically what you want to do now is just wrap your string in the above
parse()function, instead ofint()orNumber()as you would typically.