I am new at flash, the below is my script, i have 3 textinput boxes, name1, name2, name3 and 3 dynamic texts, output1, output2, output3. Once the user, enters the text in the box, it should appear exactly the same in the dynamic output text. It works for the first one, but does not work for the second and third one. I renamed changehandlers differently to remove compile errors, but now only the first one works. Is there a better way of doing this, if i want to have multiple textbox entrees?
name1.addEventListener(Event.CHANGE, changeHandler);
function changeHandler(e:Event):void
{
output1.text = name1.text
}
name2.addEventListener(Event.CHANGE, changeHandler);
function changeHandler1(e:Event):void
{
output2.text = name2.text;
}
name3.addEventListener(Event.CHANGE, changeHandler);
function changeHandler2(e:Event):void
{
output3.text = name3.text;
}
You forgot to change the name of the listener functions in the latter two
addEventListener()calls. It currently callschangeHandler()on all three events.You should have:
You can create a class that manages joining the input text field with the output text field:
And now you can loop through your text fields and join them using this: