having trouble removing loaded child object b4 loading a new one
i can load a child object with this script if button is pressed:
[COLOR=#0000ff]mc_char.btn_darkangel.addEventListener(MouseEvent.CLICK, Response_btn_darkangel);[/COLOR]
[COLOR=#0000ff]function Response_btn_darkangel(e:MouseEvent):void[/COLOR]
[COLOR=#0000ff]{ [/COLOR]
[COLOR=#0000ff] char_image.text = “Dark-Angel.gif”;[/COLOR]
[COLOR=#0000ff] char_loader.load(new URLRequest(char_image.text));[/COLOR]
[COLOR=#0000ff]}[/COLOR]
[COLOR=#0000FF]char_loader[/COLOR][COLOR=#0000ff].contentLoaderInfo.addEventListener(Event.COMPLETE, startListener);[/COLOR]
[COLOR=#0000ff]function startListener(e:Event):void[/COLOR]
[COLOR=#0000ff]{[/COLOR]
[COLOR=#0000ff] MovieClip(root).mc_display.mc_portrait_display.addChild([/COLOR][COLOR=#0000FF]char_loader[/COLOR][COLOR=#0000ff].content);
}[/COLOR]
and i can unload the child object with this script if clear button is pressed:
[COLOR=#0000ff]btn_clear.addEventListener(MouseEvent.CLICK, Response_btn_clear);[/COLOR]
[COLOR=#0000ff]function Response_btn_clear(e:Event):void[/COLOR]
[COLOR=#0000ff]{[/COLOR]
[COLOR=#0000FF]MovieClip(root).mc_display.mc_char_display.removeChild(char_loader.content);[/COLOR]
[COLOR=#0000ff]}[/COLOR]
but having difficulty unloading child object when just that [COLOR=#0000FF]mc_char.btn_darkangel[/COLOR] button is pressed. Cause otherwise it just adds another instance then another and another and the different instances kinda pile ontop of each other
my question is how can i incorporate [COLOR=#0000ff]removeChild[/COLOR] script so that [COLOR=#0000FF]mc_char.btn_darkangel [/COLOR]doesn’t just pile instances of image ontop of each other