but...
does neone know how to change a variable into a number?
such as
Thank you.Code:String = "23";
Number = function ??(String);
Number = 23;
Printable View
but...
does neone know how to change a variable into a number?
such as
Thank you.Code:String = "23";
Number = function ??(String);
Number = 23;
Either use new Number() or parseInt():
code:
str = "23";
num = new Number(str); // convert to any number, including floating points
or
code:
str = "23";
num = parseInt(str); // only works if the number is an integer (there is a parseFloat() as well)
^Thanks, that got my code working now :)
Can't you just use
code:
str = "21212";
number = int(str);
or is it old syntax?
In flash you can simply just write:
String = "23"
Number = String