Masking Problem

hi i am a beginner AS3 coder and

this is what i made for banners for my church.

http://pratt.edu/~wsong/banner/banner.html

there is a Box class exported from a created movieclip insida flash its a just white square i used to make a boxes for the mask.

it seems working fine but problem is, sometimes the mask animation stops in the middle of the tweening. it doesnt happen alot but happens sometimes. im wondering whats the problem with my coding and how to solve it. thank you

ps. also, if you can find wether my coding is adding unneeded childs as the time goes on because i just noticed after leaving the banner for more than 4-5 min, it gets extremely slow, i guess there is something thats keep being added and not being removed or replaced. if you can find it please let me know thank you.


import fl.transitions.Tween;
import fl.transitions.TweenEvent;
import fl.transitions.easing.*;
 
var myLoader:Loader;
var myRequest:URLRequest;
var myContainer:MovieClip;
var box:MovieClip;
var boxCon:MovieClip;
var ranNum:Number;
var time:uint = 5;
var imageMax:uint = 4;
var imageCur:int = 1;
 
 
 
function createBox():void{
    boxCon = new MovieClip();    
    addChild(boxCon);
    setChildIndex(boxCon,0);
    myLoader.mask = boxCon;
    for(var i:Number=0; i<5; i++){
        for(var h:Number=0; h<5; h++){
            box = new Box();
            box.x = box.width/2+(i*box.width);
            box.y = box.height/2+(h*box.height);
            boxCon.addChild(box);
 
            var boxTween1:Tween = new Tween(box, "scaleX", Regular.easeOut, 0, 1, ranNum*1, true); 
            var boxTween2:Tween = new Tween(box, "scaleY", Regular.easeOut, 0, 1, ranNum*1, true);    
 
            ranNum = Math.random();
        }
    }
}
 
 
 
function onTimer(event:TimerEvent):void{
    nextImage();
}
 
function nextImage():void{
 
    myRequest = new URLRequest("data/banner/image"+imageCur+".jpg");
    myLoader.load(myRequest);
    myLoader.name = String(imageCur);
 
    createBox();
    if (imageCur == imageMax){
        imageCur = 1;
    }else{
        imageCur++;
    }
}
 
 
function onClick(event:MouseEvent):void{
 
    navigateToURL(new URLRequest(myLoader.name+".html"),"_self");
 
}
 
 
function initiate():void{
 
    myContainer = new MovieClip();
    addChild(myContainer);
    myLoader = new Loader();
    myRequest = new URLRequest("data/banner/image1.jpg");
    myLoader.load(myRequest);
    myContainer.addChild(myLoader);
    ranNum = Math.random();
    myContainer.buttonMode = true;
    var timer:Timer = new Timer(time*1000);
    timer.addEventListener(TimerEvent.TIMER, onTimer);
    timer.start();
    createBox();
    myLoader.addEventListener(MouseEvent.CLICK, onClick);
    myLoader.name = String(imageCur);
    imageCur++;
 
 
}
 
 
initiate();