UIObject.destroyObject()

Availability

Flash Player 6 (6.0.79.0).

Edition

Flash MX 2004.

Usage

destroyObject(instanceName)

Parameters

instanceName A string indicating the instance name of the object to be destroyed.

Returns

Nothing.

Description

Method; destroys a component instance.

Example

The following example removes the TextInput instance my_ti when the button is clicked. With a Button and a TextInput component in the current document's library, add the following code to the first frame of the main timeline:

//Create textinput and button instances
this.createClassObject(mx.controls.TextInput, "my_ti", 1, {text:"Hello World"});
this.createClassObject(mx.controls.Button, "my_button", 2, {label:"My Button"});
//Shift button to be below text input
my_button.move(my_ti.left, Stage.height - my_ti.bottom);

//Create Listener Object for button click
var buttonListener:Object = new Object();
buttonListener.click = function(evt_obj:Object){
    destroyObject("my_ti");
}
//Add Listener
my_button.addEventListener("click", buttonListener); 

Flash CS3