| Register | FAQ | Calendar | Search | Today's Posts | Mark Forums Read |
|
#1
| |||
| |||
| 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; |
|
#2
| |||
| |||
| 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/ |
|
#3
| |||
| |||
| 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. |
|
#4
| |||
| |||
| 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. |
|
#5
| |||
| |||
| 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? |
|
#6
| |||
| |||
| 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(); |
|
#7
| |||
| |||
| 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 ![]() |
![]() |
| Thread Tools | |
| Display Modes | |
In an effort to better serve ads to our visitors, cookies are used on objectmix.com. For more information, check out our Privacy Policy.