I want to add a listener to two textfields in an mc, not sure how to change the function to work properly in a class. The mc has a class associated to it. I have included the code below.
Thanks for any help
The error I get for each function
Line 23: '(' expected
function description.onChanged(textfield_txt:TextField) {
Line 20: The same member name may not be repeated more than once.
function titlename.onChanged(textfield_txt:TextField) {
class Note extends MovieClip {
var x:Number;
var y:Number;
public var titlename:TextField;
public var description:TextField;
public var txtListener:Object = new Object();
public function Note() {
titlename.value = "Enter Your Title";
description.value = "Enter Your Description";
trace("+++++++");
titlename.addListener(txtListener);
description.addListener(txtListener);
}
function setInfo() {
}
function getInfo() {
}
function titlename.onChanged(textfield_txt:TextField) {
trace(textfield_txt._name+" changed");
};
function description.onChanged(textfield_txt:TextField) {
trace(textfield_txt._name+" changed");
};
function txtListener.onChanged(textfield_txt:TextField) {
trace(textfield_txt._name+" changed and notified myListener");
};
}