I'm creating a large "movie" using flash professional CC and AS3. In one scene I want my character to be IMing his friend. The scene is already animated and shows the back of his head and the viewer can read his screen.
I want the user to be able to type for my character, so whatever the user types shows up in the bottom of the chat box, and then when the user presses enter the same text appears in a different place on the screen.
Unfortunately I haven't even gotten CLOSE to making that happen. So far I'm stuck on getting the text from the input box to appear in a dynamic textbox elsewhere, so I've been watching tons of tutorials. This code runs without errors but does not output the text like I want.
var outputString = outputBox.text; //get key presses only when textfield is edited
inputBox.addEventListener(KeyboardEvent.KEY_DOWN, handler);
function handler(event:KeyboardEvent) { //13 is enter key
function handler(event:KeyboardEvent) { //13 is enter key
if(event.charCode == 13) {
outputBox.text = "UserName: " + outputString;
}
}
(Please ignore the bad indentation, that's more of an issue with me not understanding how to paste code here haha.)
Anyways does anyone know what's wrong? I have been trying to figure this out for days so if anyone could share some example code for how to get what I described working properly it would be immensely appreciated. All I really need to be able to do is save the user input so I can display it whererever I want. Thanks for reading!