Some favorite site feeds aggregated locally: iPhone Development RSS   Adobe Labs RSS   Macrumors RSS

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.
 
 Return to the main page
Comments:

There are currently 0 Comments:

 Leave a comment