MovieClipLoader's loadClip method is loading swf beforeits downloaded 100%??

This is a discussion on MovieClipLoader's loadClip method is loading swf beforeits downloaded 100%?? within the Macromedia Flash forums in Adobe Tools category; Hello everyone, I created a MovieClipLoader a few days ago that is reuseable. I will be using the same preloader graphics when I am loading in external swf on my stage. My MovieClipLoader functions fine with jpegs and smaller sized swf files. But whenever I load a larger sizes swf it loads the movie before it has fully downloaded in simulation mode. The odd part is that everything works fine with smaller swf files but not larger ones . I have tested a few movies and that seems to be the common theme. In the example below main.swf is the ...

Go Back   Application Development Forum > Adobe Tools > Macromedia Flash

Object Mix

Register FAQ Calendar Search Today's Posts Mark Forums Read
  #1  
Old 08-28-2008, 01:40 AM
fcastro75
Guest
 
Default MovieClipLoader's loadClip method is loading swf beforeits downloaded 100%??

Hello everyone,

I created a MovieClipLoader a few days ago that is reuseable. I will be using
the same preloader graphics when I am loading in external swf on my stage. My
MovieClipLoader functions fine with jpegs and smaller sized swf files. But
whenever I load a larger sizes swf it loads the movie before it has fully
downloaded in simulation mode. The odd part is that everything works fine with
smaller swf files but not larger ones . I have tested a few movies and that
seems to be the common theme.

In the example below main.swf is the clip I am loading into "mcBackground".

var mclTV : MovieClipLoader = new MovieClipLoader ();
var loadListener : Object = new Object ();
// events it will handle
loadListener.onLoadStart = function ()
{
trace ("onLoadStart");
trace (this._target);
progress_mc._y == 268;
txtLoaded._visible = true;
progress_mc._visible = true;
};
loadListener.onLoadProgress = function (target : MovieClip, bytesLoaded :
Number, bytesTotal : Number)
{
txtLoaded.text = String (Math.floor (bytesLoaded / bytesTotal * 100)) + "%
loaded";
progress_mc._xscale = bytesLoaded / bytesTotal * 100;
};
loadListener.onLoadComplete = function ()
{
trace ("onLoadComplete");
txtLoaded._visible = false;
progress_mc._visible = false;
};
mclTV.addListener (loadListener);
mclTV.loadClip ("main.swf", mcBackground); //mcBackground is an empty
movieClip on the stage
txtLoaded._visible = false;
progress_mc._visible = false;




Reply With Quote
  #2  
Old 08-28-2008, 08:25 AM
DMennenoh **AdobeCommunityExpert**
Guest
 
Default Re: MovieClipLoader's loadClip method is loading swf before its downloaded 100%??

You should use onLoadInit instead of onLoadComplete.

Also, depending on the file you're loading - swf files are meant to stream.
What I do is all my content files have an activate() function in them. That
function is called in the onLoadInit method of the loader.

--
Dave -
www.offroadfire.com
Head Developer
http://www.blurredistinction.com
Adobe Community Expert
http://www.adobe.com/communities/experts/


Reply With Quote
  #3  
Old 09-04-2008, 02:36 AM
fcastro75
Guest
 
Default Re: MovieClipLoader's loadClip method is loading swfbefore its downloaded 100%??

Dave thanks for the reply.

I have traced the problem to be that the movie that I have loading in does not
have a stop action on the first frame (similar to what you mean't by suppose to
stream). So what I did was added a stop(); withing the onLoad and then a
play(); with in the onLoadInit.

I tried inserting a stop() within the movie I was loading but it seems flash
only sees the main container I am loading into and not the actual movie.

I am interested in this approach about adding a activate() function could you
post an example? I don't see a way of targeting the movie clip that is loading.
I can target the container which is why the play and stop work.

Reply With Quote
  #4  
Old 09-04-2008, 10:48 AM
Rothrock
Guest
 
Default Re: MovieClipLoader's loadClip method is loading swfbefore its downloaded 100%??

Not sure exactly what Dave does, but here is what I would do:

On the first frame of the main timeline of your clip:

var home:MovieClip=this;

function activate{
home.play();
delete activate;
}

if(this != _root){
this.stop();
} else {
delete activate;
}

I would also put artwork on the frame of a alpha=0 rectangle the size of the
stage so that loading documents would be able to figure out the size of the swf.

The first bit defines the current timeline as "home." The next bit defines the
activate function. By saying home.play() we are sure that it is the scope of
the loaded swf and not the scope calling the function (maybe the event handler
scope)? And finally deletes itself when it has been called. This should prevent
some kind of accidental multiple call when you don't want.

The next bit checks to see if the main timeline is the _root. If it isn't then
we stop and wait. If it is the main timeline then we don't stop and we delete
the activate function.

I haven't tested it, but that seems like what I would do.



Reply With Quote
  #5  
Old 09-04-2008, 11:54 AM
fcastro75
Guest
 
Default Re: MovieClipLoader's loadClip method is loading swfbefore its downloaded 100%??

Dave thanks for the input.

So your saying to create a function called activate and place is it within the onLoadInit and then have an if/else statement placed with the onLoadStart?


Reply With Quote
  #6  
Old 09-04-2008, 02:25 PM
Rothrock
Guest
 
Default Re: MovieClipLoader's loadClip method is loading swfbefore its downloaded 100%??

Dave's not here man.

Nope. Not at all what I'm saying, and maybe Dave does it differently.

This code would go into the file that is the external file.

Then in your onLoadInit handler you would have:

target.activate();



Reply With Quote
  #7  
Old 09-04-2008, 03:07 PM
fcastro75
Guest
 
Default Re: MovieClipLoader's loadClip method is loading swfbefore its downloaded 100%??

Sorry Rothrock!! I must have been really tired yesterday when I posted back.
Very interesting I think I understand what you are getting at now. I am going
to give it a go and post back as soon as I get my work done



Reply With Quote
Reply


Thread Tools
Display Modes


All times are GMT -5. The time now is 02:36 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
vB Ad Management by =RedTyger=

In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.