I was wondering if there is a way to convert a number into a corresponding letter in flash. The effect I am looking for is I want to randomly generate letters which will fill in a text field. The letter is then checked if it matches what it is supposed to be, if not another number is generated and compared. Basically the letter will keep changing until the correct letter comes up then it stops. I have no problem with the code to do this, just wondering if there is an easier flash command to convert a number to a letter than having to load each letter into an array.
myNumber.toString();
or even
(5).toString();
I also just found
var = chr(number);
in the AS dictionary, thanks for the help
-
chr is deprecated
“Flash Player 4. This function has been deprecated in Flash 5”
meaning it might not work in the next flash version -
if returns a letter based on the Character Code of the number passed, NOT the number as a string value
that was what I wanted, I wanted a way to convert the ASCII code for a number into the actual character, I couldn’t really figure out how to do that with .toString
Nevermind, I figured out how to use toString(); thanks for your help.
:!:
Theres also a tutorial on this…
http://www.kirupa.com/developer/flash5/randomlettercycling.htm
http://www.kirupa.com/developer/flash5/randomlettercycling2.htm
Although Flash 5, and can still be optimized some, they still work.