number input
set up stage:
add actions to layer 1 frame 1:
//Add keypress event to lucky_number instance of Input Text: lucky_number.addEventListener(KeyboardEvent.KEY_DOWN, keypress); function keypress(event:KeyboardEvent):void { //You can discover keyCode by using: trace(event.keyCode); //If the user hits the Enter key (keyCode 13): if (event.keyCode == 13){ var num = parseInt(lucky_number.text); trace( String(num) + " squared is " + String( num * num )); lucky_number.text = ""; } }