A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Key.getAscii want ascii of the char

  1. #1
    Member
    Join Date
    Mar 2009
    Location
    Pune
    Posts
    62

    Key.getAscii want ascii of the char

    I want to create a custom input text box in as2. so i want to know which character(a,b,c) has been pressed by the user. but Key.getCode() and key.getAscii() both return the same value(key code)
    How will i get the ascii of the character presses by the user.

  2. #2
    Member
    Join Date
    Mar 2009
    Location
    Brooklyn, NY
    Posts
    77
    This will trace the letter out. You'll just need to incorporate it into your function:
    Code:
    var keyListener:Object = new Object();
    
    keyListener.onKeyDown = function() 
    {   
       checkKey(chr(Key.getAscii()));
    };
    Key.addListener(keyListener);
    
    function checkKey(pressedKey:String):Void
    {
    	trace(pressedKey);
    }
    Break it until it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center