Im unable to figure out why the border I create is not removing its self after I removeChild.
Here is my code:
function gallerySet(event:MouseEvent):void {
picLoad.load(new URLRequest(myXML.Gallery[galNum].Image[event.target.name].@picURL));
picWidth = myXML.Gallery[galNum].Image[event.target.name].@Width;
picHeight = myXML.Gallery[galNum].Image[event.target.name].@Height;
addChild(holder);
holder.addChild(picLoad);
holder.addChild(bordCon);
TweenLite.to(holder, .5, {alpha:1});
//TweenLite.to(border1, .5, {alpha:1});
picLoad.x = ((holder.width - picWidth) / 2) + 75;
picLoad.y = (holder.height - picHeight) / 2;
var border1:Shape = new Shape();
border1.graphics.lineStyle(1, 0xffffff);
border1.graphics.drawRect(picLoad.x, picLoad.y, picWidth, picHeight);
bordCon.addChild(border1);
picLoad.alpha = 0;
TweenLite.to(picLoad, 2, {alpha: 1});
holder.exitBtn.addEventListener(MouseEvent.CLICK, exit2);
holder.addEventListener(MouseEvent.MOUSE_DOWN, dragOn2);
holder.addEventListener(MouseEvent.MOUSE_UP, dragOff2);
}
//this is where I exit the holder...
function exit2(event:MouseEvent):void {
TweenLite.to(holder, .5, {alpha:0});
TweenMax.to(bkg, .5, {alpha:1});
holder.addEventListener(Event.ENTER_FRAME, exit2b);
}
function exit2b(event:Event):void {
if (holder.alpha == 0 ) {
bordCon.removeChildAt(0);
removeChild(holder);
holder.removeEventListener(Event.ENTER_FRAME, exit2b);
}
}
the holder and border goes away, however when I go to another gallery the previous borders pop up. Instead of creating a new border and deleting the old one it is creating a new border and the old one still remains.