[Flashcoders] Reusing MovieClipLoader Listeners

2006-04-12 Thread lincoln
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


Re: [Flashcoders] Reusing MovieClipLoader Listeners

2006-04-12 Thread Patrick Matte

You are loading your images at the same time !
Load the first image and then onLoadComplete, start loading the second 
image...




- Original Message - 
From: lincoln [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, April 12, 2006 11:39 PM
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


RE: [Flashcoders] Reusing MovieClipLoader Listeners

2006-04-12 Thread Mike Anderson
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


Re: [Flashcoders] Reusing MovieClipLoader Listeners

2006-04-12 Thread Patrick Matte
I think you should load only one image at a time. So make sure the first 
image has completely loaded before you start loading the second image.
If you press the 2nd button before the first image has finished loading, you 
will have 2 images loading at the same time...


- Original Message - 
From: lincoln [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, April 12, 2006 11:51 PM
Subject: Re: [Flashcoders] Reusing MovieClipLoader Listeners


I apologize.  For the sake of brevity, I actually took out the fact  that 
I'm calling this function based on an onRelease function. For  example:


mybtn,onRelease = function(){
preloadImage(images/5.2.1a.jpg, image_mc);
}

mybtn2,onRelease = function(){
preloadImage(images/5.2.2a.jpg, image_mc);
}

so they defo fire at separate times.


On Apr 12, 2006, at 8:39 PM, Patrick Matte wrote:


You are loading your images at the same time !
Load the first image and then onLoadComplete, start loading the  second 
image...




- Original Message - From: lincoln 
[EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Wednesday, April 12, 2006 11:39 PM
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



___
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