PDA

View Full Version : syntax for adding input text box with code only


thanksforhelping
10-10-2008, 01:44 PM
Can't seem to find the code that I can understand that will create an instance of an input text box [from pure code-not pre-drawn on stage]
I want it to appear when letter "b" is pressed, after being in "special listening mode" after backspace key is pressed), until the user presses the "enter key" which then registers the inputed text to variable named "ipt" where # increases as the variable j increases ?
and then (removes textbox).
I need to do this using only 1 frame.

I figure I need to create another keylistener function to listen for the "enter" key after the input textbox is activated?,
Do I suspend the keylistener L so the user can type into the input textbox?
I noted in where I think it needs to go but am clueless about what I need?
I'm stupid about code, if you could offer the syntax of how to create input text box and then where to put it that would be brilliant!




//normal state key listener
normal = new Object();
//special info input key listener
L = new Object();
//info input key listener function
L.onKeyDown = function() {
if(Key.getAscii()==32) {textbox_txt.text="space";
} else if(Key.getAscii()==9) {textbox_txt.text="cancel listener";
Key.removeListener(L);
} else if(Key.getAscii()==97) {textbox_txt.text="a";
} else if(Key.getAscii()==98) {textbox_txt.text="b";
//HERE IS WHERE I NEED AN INPUT TEXTBOX to listen for input, assign to var "inp"
//until enter key is pressed, and then need to remove input textbox

} else if(Key.getAscii()==99) {textbox_txt.text="c";
} else {textbox_txt.text="other1"+Key.getAscii();}
}
//normal state key listener function
normal.onKeyDown = function() {
if(Key.getAscii()==13) {textbox_txt.text="return";
}
//call special input listener on backspace key press
else if(Key.getAscii()==8) {textbox_txt.text="back";
Key.addListener(L);
} else {textbox_txt.text="other";}
}



Thanks for any help!
TFH