Tuesday, July 29, 2008
Using the keyboard to send numerals
Tuesday, July 29, 2008
var sValue:String = String.fromCharCode(event.charCode);
var nValue:Number = Number(sValue);
if( isNaN(nValue) return;
someClass.send( nValue);
I don't know if this is really the best way to ensure numbers (0-9) are sent to a class method for use as a number or not, but it works as far as I can tell without testing every key. Wondering if others have different methods.
Comments:
There are currently 0 Comments:

