var textout:TextField = new TextField() if (textout.text !== " " ) { if (textout.parent) textout.parent.removeChild(textout); //<------ } textout.text = "test"; parent.addChild(textout);