View Full Version : Tracing a letter with its ascii code
stupid guy
May 19th, 2009, 04:16 AM
I know letters have a number code to them, or ascii code, how can I use this to trace a letter with a number, for example lets say the ascii code for the letter 'a' is 97, in AS3 is there a way todo something like:
trace(asciiToString(97));
to trace out 'a', thanks in advance.
Shaedo
May 19th, 2009, 05:09 AM
I know this is not at all what your asking for but I use a massive switch statement to achieve a similar effect.
devonair
May 19th, 2009, 09:10 AM
You can use the static fromCharCode() method of the String class:
trace (String.fromCharCode(97));
kadaj
May 19th, 2009, 09:16 AM
an easy way to do is
Choose Player as : Adobe Air 1.1
You can do it inside Publish Setting (Flash Tab) under File menu.
Then the AS 3.0 code is
stage.addEventListener(KeyboardEvent.KEY_DOWN,keyb oardListener);
function keyboardListener(event:KeyboardEvent)
{
trace(event.keyCode);
}
stupid guy
May 19th, 2009, 02:35 PM
Thank you!
trace (String.fromCharCode(97));
is exactly what I was looking for.
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.