|  | MovieClipLoader's loadClip method is loading swf before its |  | |
| | | fcastro75 |  |
| Posted: Thu Aug 28, 2008 5:40 am Post subject: MovieClipLoader's loadClip method is loading swf before its |  |
| |  | |
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; |
| |
| | | DMennenoh **AdobeCommunit |  |
| Posted: Thu Aug 28, 2008 10:25 am Post subject: Re: MovieClipLoader's loadClip method is loading swf before |  |
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 - LINK Head Developer LINK Adobe Community Expert LINK |
| |
| | | fcastro75 |  |
| Posted: Thu Sep 04, 2008 6:36 am Post subject: Re: MovieClipLoader's loadClip method is loading swf before |  |
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. |
| |
|
|