User Guide
TextField.replaceSel() 743
txtListener.onChanged = function(textfield_txt:TextField) {
trace(textfield_txt+" changed. Current length is: "+textfield_txt.length);
};
my_txt.addListener(txtListener);
removeListener_btn.onRelease = function() {
trace("Removing listener...");
if (!my_txt.removeListener(txtListener)) {
trace("Error! Unable to remove listener");
}
};
TextField.removeTextField()
Availability
Flash Player 6.
Usage
my_txt.removeTextField() : Void
Description
Method; removes the text field specified by my_txt. This operation can only be performed on a
text field that was created with
MovieClip.createTextField(). When you call this method, the
text field is removed. This method is similar to
MovieClip.removeMovieClip().
Example
The following example creates a text field that you can remove from the Stage when you click the
remove_btn instance. Create a button and call it
remove_btn, and then add the following
ActionScript to your FLA or AS file.
this.createTextField("my_txt", this.getNextHighestDepth(), 10, 10, 300, 22);
my_txt.text = new Date().toString();
my_txt.border = true;
remove_btn.onRelease = function() {
my_txt.removeTextField();
};
TextField.replaceSel()
Availability
Flash Player 6.
Usage
my_txt.replaceSel(text:String) : Void
Parameters
text
A string.