delete scrollPane source - removeChild doesn't work
Hello,
I'm creating one sprite named 'holder' and I'm adding childs to it.
finally I use sp.source = "holder"; NOTE: scrollPane is in stage, having instance name = sp, holder is AS created.
this works very good, but I need to on button press refresh data on holder.
So I want to complete remove holder, so my function can recreate it with new elements and then define scrollPane.source = "holder";
How can I do this?
var holder:Sprite = new sprite();
holder.name = "holder";
addChild(holder); // this adds holder to stage
//
// add elements to holder
//
sp.source = "holder";
button.addEventListenner(MouseEvent.CLICK, limpar_sp);
function limpar_sp(e:Event):void {
var rh:Sprite;
rh = Object(sp.content);
sp.removeChild(rh);
}
this fires an error, saying holder isn't a child of sp, witch is true, is stage child, but was used as source of holder.
Thanks
Pluda