Preloader

Hi,

On my Website I have a main swf. The main swf will have buttons to load in external swf. The preloader is on the main swf. If I test the movie and click on the link more than once while it’s preloading or click on another link while it’s preloading the bytesLoaded will keep adding on each swf’s bytes I click on. The bytesTotal doesn’t change, it will just equal the first swf I clicked on.

So my question is how do I fix it so when I click on the same link or another link while it preloads the bytesLoaded resets to 0.

Here’s the preloader code


 mLoader.contentLoaderInfo.addEventListener(Event.OPEN,showPreloader);
            mLoader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS,showProgress);
            mLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,showContent);

//Connects the buttons and the external swf
function loadSWF(evt:MouseEvent):void {

            for (i = 0; i<buttonCount; i++) {
                if (evt.target.name == aButtons*.name) {
                    //trace(evt.target.name);
                    index = i;
                }
            }
            mRequest=new URLRequest(aSWF[index]);
            mLoader.load(mRequest);

        }
        /*********************** Preloader **********************/
    
        function showPreloader(evt:Event):void {
            addChild(mPreloader); // adds preloader to the stage
          
        }
        function showProgress(evt:ProgressEvent):void {
            trace("bytes loaded "+ Math.round(evt.bytesLoaded/1000) + "kb")
            trace("total bytes " + Math.round(evt.bytesTotal/1000) +"kb")

            var percentLoaded:Number = evt.bytesLoaded/evt.bytesTotal;
            mPreloader.tLoading.text = Math.round(percentLoaded * 100) + " %"; // shows percentage in textfield (tLoading)

        }

        function showContent(evt:Event):void {
            removeChild(mPreloader); // Remove preloader from stage once all content is loaded
            addChild(mLoader); // add Content to stage
           
        } 

Thanks

vxd