Skip to main content
Participant
December 30, 2009
Question

listerner and their share in textfields

  • December 30, 2009
  • 1 reply
  • 189 views

Hi, I have a problem with the following code:

function colorText() {
this.background = true;
this.backgroundColor = 0x0000FF;
}
color = new Object();
color.onChanged = colorText;

name.addListener(color);
surname.addListener(color);

name and surname are two input textfield. I'd like to change the background color of the textfields when the text change, but it doesn't work because "this" in the function is not interpreted correctly. If I try to change "this" with for example with name the code works, so the problem is that "this". How can i share the listener for more textfield?

regards Cibernow

    This topic has been closed for replies.

    1 reply

    fpMonster
    Adobe Employee
    Adobe Employee
    January 7, 2010

    Are you working on ActionScript2 or 3?