# Convert Number to Letter

**URL:** <https://forum.kirupa.com/t/convert-number-to-letter/16544>\
**Category:** flash\
**Created:** [March 26, 2003, 12:07am UTC](https://forum.kirupa.com/t/convert-number-to-letter/16544 "2003-03-26T00:07:33Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sorcerer](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@Sorcerer](https://forum.kirupa.com/u/Sorcerer)\
**Post date:** [March 26, 2003, 12:07am UTC](https://forum.kirupa.com/t/convert-number-to-letter/16544/1 "2003-03-26T00:07:33Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 26, 2003, 12:17am UTC](https://forum.kirupa.com/t/convert-number-to-letter/16544/2 "2003-03-26T00:17:49Z")

</div>

myNumber.toString();  
or even  
(5).toString();

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 26, 2003, 12:22am UTC](https://forum.kirupa.com/t/convert-number-to-letter/16544/3 "2003-03-26T00:22:27Z")

</div>

I also just found

var = chr(number);

in the AS dictionary, thanks for the help

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 26, 2003, 12:26am UTC](https://forum.kirupa.com/t/convert-number-to-letter/16544/4 "2003-03-26T00:26:42Z")

</div>

1. chr is deprecated  
“Flash Player 4. This function has been deprecated in Flash 5”  
meaning it might not work in the next flash version

2. if returns a letter based on the Character Code of the number passed, NOT the number as a string value

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 26, 2003, 7:37pm UTC](https://forum.kirupa.com/t/convert-number-to-letter/16544/5 "2003-03-26T19:37:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 26, 2003, 9:05pm UTC](https://forum.kirupa.com/t/convert-number-to-letter/16544/6 "2003-03-26T21:05:17Z")

</div>

Nevermind, I figured out how to use toString(); thanks for your help.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 26, 2003, 9:21pm UTC](https://forum.kirupa.com/t/convert-number-to-letter/16544/7 "2003-03-26T21:21:22Z")

</div>

:!:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 26, 2003, 9:45pm UTC](https://forum.kirupa.com/t/convert-number-to-letter/16544/8 "2003-03-26T21:45:56Z")

</div>

Theres also a tutorial on this… 😉

[http://www.kirupa.com/developer/flash5/randomlettercycling.htm](http://www.kirupa.com/developer/flash5/randomlettercycling.htm)  
[http://www.kirupa.com/developer/flash5/randomlettercycling2.htm](http://www.kirupa.com/developer/flash5/randomlettercycling2.htm)

Although Flash 5, and can still be optimized some, they still work.
