Changing the text in the textfield

I want to change the text in textfield1 with the inputted text in textfield2…

for example, the text in textfield1 is “HELLO” i want to make it “HI” by inputing “HI” in textfield2 after clicking the change button the “HELLO” text will replace by “HI”

changeButton.addEventListener (MouseEvent.CLICK, onClick)
{
textfield1.text = textfield2.text
}

not working… what should i do? any help pls?? thanks!