Checking and Removing Clip (inside parent clip)

Hey everyone. I’m having problems with something somewhat simple. We’re going to a trade show and needed a video that would randomly load a SWF clip on one scene, then I have the timeline move to another after a delay and then go to the next part to load an image, then I have it restart and do it again, for a never-ending looping video at our booth.

I’m running into an issue though, when it loops and plays the SWF for the 2nd time, the old content still remains and the new content plays over the previous one. I figured the issue was I needed to remove the previous clip before loading a new one. I found some code that I thought SHOULD work but can’t seem to get it right.


stop();

var threeSecondTimer = setInterval(showMessage,3000);

function showMessage(){
    
var quoteRand = Math.round(Math.random() * 9) + 1;
    
var quoteLoader:Loader = new Loader();
if (quoteRoll.getChildByName("quoteLoader") == null) {

        quoteRoll.addChild(quoteLoader);

} else {

    quoteRoll.removeChild(quoteLoader);
    quoteRoll.addChild(quoteLoader);

}

var quoteURL:URLRequest = new URLRequest("quoteRoll/" + quoteRand + ".swf");
quoteLoader.load(quoteURL);

play();
clearInterval(threeSecondTimer);

}

What happens is I have a clip I manually created (for fade tween etc more easily: quoteRoll) and am creating/loading quoteLoader into it with addChild. However, I can’t seem to get a correct path for the script to recognize on the 2nd time through that quoteLoader exists and it needs to removeChild first.

Any help? We fly out in the morning and I’ve been banging my head against the wall about this for a good bit.