Are you sure it just doesn't "appear that way", but in reality, it's
just happening so fast - that it looks like it's not working at all?

I just ask, because I have a Map Application that I wrote - and it
downloads quite large SWF files - in which a progress bar gets updated
based on the loader progress.

It works great, when I load the map for the first time, but subsequent
accesses makes the progress bar appear and disappear, without the
scrolling behavior.

It occurred to me afterwards, that after the initial load, it was
grabbing the file from my cache locally.  When I jumped to a different
PC (with an empty cache) it worked great once again - of course until
the time when I loaded it the 2nd time.  So just make sure that your
problem isn't because you are loading something that you technically
already have (sitting in your cache).

Just something to consider, before investing too much time into this
problem.

Also, YES I reuse MY Loader over and over, for different SWF files, and
it does work just fine.  You don't have to do anything differently - so
I am not sure what else may be happening, if it doesn't end up being
what I mentioned above.

Hth,

Mike 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of lincoln
Sent: Wednesday, April 12, 2006 10:39 PM
To: Flashcoders mailing list
Subject: [Flashcoders] Reusing MovieClipLoader Listeners

I have a function that I'm using to preload images into a container  
clip using the MovieClipLoader class.   The preloader works fine on  
the initial image but on successive calls to the function, the
onLoadProgress seemingly never fires (in order to update the percentage
in a textfield).  However, the onLoadInit does fire and the preloader
fades away.  The manual says to use onLoadComplete for repeated usages
of listeners, but it doesn't seem to allow me to continuously reuse the
listener to load in another image.  How do I set this up to allow
multiple calls to the function and have the preloader fire from
0%->100%?



function preloadImage(img:String,target:MovieClip):Void{

        var mclListener:Object = new Object();
        var image_mcl:MovieClipLoader = new MovieClipLoader();
        image_mcl.addListener(mclListener);

        mclListener.onLoadComplete = function(target_mc:MovieClip,
httpStatus:Number):Void {
                // should I remove the listener here and delete the obj?
        }
        

        /*
        this function never fires properly after the first call!
        */      

        mclListener.onLoadProgress = function(target:MovieClip,
bytesLoaded:Number, bytesTotal:Number):Void {
                photoLoaded = Math.round(100/bytesTotal*bytesLoaded);
                MainLoader.load_text.LoadPer1.text = "Loading
"+photoLoaded+"%";
        }

        mclListener.onLoadInit = function(target_mc:MovieClip) {
                preloadFadeOut();
        };
                

        image_mcl.loadClip(img, target);
};



preloadImage("images/5.2.1a.jpg", image_mc);  // this one preloads
great!

preloadImage("images/5.2.2a.jpg", image_mc);  // this does not have
onLoadProgress but fires onLoadInit

any ideas? thanks!
-l
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to