package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.events.MouseEvent;
public class RemoveChildExample extends Sprite {
private var _label:TextField;
public function RemoveChildExample( ) {
_label = new TextField( );
_label.text = "Some Text";
addChild( _label );
stage.addEventListener( MouseEvent.CLICK, removeLabel );
}
public function removeLabel( event:MouseEvent ):void {
removeChild( _label );
}
}
}
|