Can you help with some code to determine if it has already been added as a child? If it is not there, I get the following error (because there is no child to remove):
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/removeChild()
at Scale6_fla::MainTimeline/frame83()
at flash.display::MovieClip/gotoAndStop()
at Scale6_fla::MainTimeline/infoBottomStopDrag()
I have been trying to come up with an if/then statement to see if it has been added as a child and then remove it if it has. Any help with that would be greatly appreciate.
Thanks.
Dave
type your textfield so a reference always exists (until you null the reference):
var tf:TextField; // you don't need to instantiate it unless you need it.
you can then use the following:
removeF(tf);
function removeF(dobj:DisplayObject){
if(dobj.stage!=null){
dobj.parent.removeChild(dobj);
}
}