It doesn't work because of the infamous scope problem.
the "this" in the function refers to the erase_btn, and "var2" is not an
attribute of the button.
You need to use the Delegate:
import mx.utils.Delegate;
erase_btn.onPress = Delegate.create(this, eraseTF);
function eraseTF(){
var2.text = "";
}
Check http://www.osflash.org/flashcoders/as2 to see the different ways
to handle events and for other implementations of the Delegate.
CARABUS mobile+ a écrit :
I done this action :
There is a dynamic textfield (var2), a button (erase_btn)
I want to erase a text, with the onPress action, it doesn¹t
erase_btn.onPress = function() {
this.var2.text = "";
};
And it doesnt work, have U got an idea ?
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders