Jump to content
GreenSock

abk

Loadermax stops functioning if it can't open a subloader

Recommended Posts

Hello,

 

I have a multi-frame fla file ...each frame has Loadermax code to load multiple images which are then tweened in succession. Upon completion of last tween, a function is called which calls nextFrame() function and advances the file to next frame's loadermax code. Sometimes I get an error - Error opening URL 'http://www.xyz.net/img/a8.jpg?gsCacheBusterID=1329993278977&purpose=audit' - and the swf stops there itself. I read in documents that each Loademax instance has skipFailed:true by default. Does this work in case of Auditing file size as well? What can I do to resolve the issue?

 

Many thanks in advance,

abk

Link to comment
Share on other sites

Yes, failed audits shouldn't stop things. I'd love to see an example FLA that I can publish on my end to see that behavior. Could you post a simple FLA and support files? I suspect there might be something else going on in your file(s).

 

You are using the latest version of LoaderMax, right? Just makin' sure.

Link to comment
Share on other sites

Hi,

 

Thanks for a quick reply.

 

I added "LoaderMax.defaultAuditSize = false;" to the code as well as estimatedBytes for each file being loaded and it's working now.

 

I've one more issue to deal with. I have a preloader fla which loads this fla. This preloader code and a sample loadermax code is pasted below.

What happens is the progress bar gets displayed twice ... once for the main movie and a small tween placed before the first LoaderMax instance gets played immediately once that progress is complete and another progressbar is displayed in the area where the Loadermax code to load multiple images which are then tweened in succession is to be displayed. I'm unable to figure out how to make the movie play only when everything is downloaded.

 

Your comments/help on the matter is highly appreciated.

 

Thanks in advance,

abk

 

preloader code

var movClip:LoaderMax = new LoaderMax({onProgress:progressHandler,onComplete:completeHandler,onError:errorHandler});

movClip.append(new SWFLoader("test.swf", { name:"test", container:this, x:0, y:0, width:900, height:350, requireWithRoot:this.root, estimatedBytes:30600}));

movClip.load();


function progressHandler(event:LoaderEvent):void
{
	bar_mc.scaleX = event.target.progress;
	loadingTxt.text = Math.round(event.target.progress*100) +"%";

}
function completeHandler(event:LoaderEvent):void
{
	removeChild(bar_mc);
	removeChild(loadingTxt);
}

 

LoaderMax instance code

var q:LoaderMax;


q = new LoaderMax({name:"a_q",onComplete:a_complete, requireWithRoot:this.root, skipFailed:true, maxConnections:4});
q.append(new ImageLoader("img/advt.png",{name:"adCap",x:10, y:-.500, container:this, alpha:0, width:250, height:200, estimatedBytes:8500}));
q.append(new ImageLoader("img/a1.jpg",{name:"a1",x:289, y:31, container:this, alpha:0, width:294, height:288, estimatedBytes:28300}));
q.append(new ImageLoader("img/a2.jpg",{name:"a2",x:289, y:31, container:this, alpha:0, width:294, height:288, estimatedBytes:15000}));
q.append(new ImageLoader("img/a3.jpg",{name:"a3",x:289, y:31, container:this, alpha:0, width:294, height:288, estimatedBytes:16000}));
q.append(new ImageLoader("img/a4.jpg",{name:"a4",x:289, y:31, container:this, alpha:0, width:294, height:288, estimatedBytes:21400}));
q.append(new ImageLoader("img/a5.jpg",{name:"a5",x:289, y:31, container:this, alpha:0, width:294, height:288, estimatedBytes:15400}));
q.append(new ImageLoader("img/a6.jpg",{name:"a6",x:289, y:31, container:this, alpha:0, width:294, height:288, estimatedBytes:13100}));
q.append(new ImageLoader("img/a7.jpg",{name:"a7",x:289, y:31, container:this, alpha:0, width:294, height:288, estimatedBytes:27700}));
q.append(new ImageLoader("img/a8.jpg",{name:"a8",x:289, y:31, container:this, alpha:0, width:294, height:288, estimatedBytes:23800}));
q.load();



function a_complete(event:LoaderEvent):void
{

	var a_cap:ContentDisplay = LoaderMax.getContent("aCap");
	main_tl.append(TweenLite.to(a_cap, .5, {alpha:1, y:10, ease:Bounce.easeInOut}));

	main_tl.append(TweenLite.to(bg, .5, {alpha:1, overwrite:false}));

	var pic1:ContentDisplay = LoaderMax.getContent("a1");
	main_tl.append(TweenLite.to(pic1, .5, {alpha:1}),-.5);
	main_tl.append(TweenLite.to(pic1, .5, {alpha:0, overwrite:false}),1);

	var pic2:ContentDisplay = LoaderMax.getContent("a2");
	main_tl.append(TweenLite.to(pic2, .5, {alpha:1}));
	main_tl.append(TweenLite.to(pic2, .5, {alpha:0, overwrite:false}),1);

	var pic3:ContentDisplay = LoaderMax.getContent("a3");
	main_tl.append(TweenLite.to(pic3, .5, {alpha:1}));
	main_tl.append(TweenLite.to(pic3, .5, {alpha:0, overwrite:false}),1);

	var pic4:ContentDisplay = LoaderMax.getContent("a4");
	main_tl.append(TweenLite.to(pic4, .5, {alpha:1}));
	main_tl.append(TweenLite.to(pic4, .5, {alpha:0, overwrite:false}),1);

	var pic5:ContentDisplay = LoaderMax.getContent("a5");
	main_tl.append(TweenLite.to(pic5, .5, {alpha:1}));
	main_tl.append(TweenLite.to(pic5, .5, {alpha:0, overwrite:false}),1);

	var pic6:ContentDisplay = LoaderMax.getContent("a6");
	main_tl.append(TweenLite.to(pic6, .5, {alpha:1}));
	main_tl.append(TweenLite.to(pic6, .5, {alpha:0, overwrite:false}),1);

	var pic7:ContentDisplay = LoaderMax.getContent("a7");
	main_tl.append(TweenLite.to(pic7, .5, {alpha:1}));
	main_tl.append(TweenLite.to(pic7, .5, {alpha:0, overwrite:false}),1);

	var pic8:ContentDisplay = LoaderMax.getContent("a8");
	main_tl.append(TweenLite.to(pic8, .5, {alpha:1}));
	main_tl.append(TweenLite.to(pic8, .5, {alpha:0, y:650, overwrite:false}),1);

	main_tl.append(TweenLite.to(bg,  .5, {alpha:0, overwrite:false}),-1);
	main_tl.append(TweenLite.to(a_cap, .5, {alpha:0, y:-300, ease:Strong.easeOut, overwrite:false, onComplete:nxtFr}),-.5);
}


Link to comment
Share on other sites

If you set autoPlay:false on your SWFLoader, it will call stop() on the main timeline initially and then you can play() whenever you want. Keep in mind, though, that it's much more complex to stop everything in a swf, like nested MovieClips, Sounds, Videos, etc. For that, you should really build the sub-swf so that it's stopped/paused initially and has a method that you call to start everything. But again, for simply stopping the main timeline of the sub-swf, set autoPlay:false on the SWFLoader. Then to play, do mySWFLoader.rawContent.play() (assuming you didn't run into any security sandbox issues).

 

Does that help?

Link to comment
Share on other sites

Thanks....but could you please comment on why the progress bar is being displayed twice? It gets displayed once for the main movie and a small tween placed before the first LoaderMax instance gets played immediately once that progress is complete and another progressbar is displayed in the area where all the Loadermax instances to load multiple images which are then tweened in succession are to be displayed.

 

Thanks in advance,

abk

Link to comment
Share on other sites

there is nothing in your code that would lead me to believe there are 2 separate progress bars being displayed in different places or why one progress bar would move to a different place. I only see references to bar_mc in the code for the first SWFLoader and its respective callbacks (onProgress and onComplete).

is there a progress bar in test.swf also?

 

i would suggest setting

 

bar_mc.visible = false

 

do they both still show up? From what I've seen of the code it seems more likely that there is other code that is causing this anomaly.

 

If you can provide a set of files stripped down to only contain the code and assets necessary to reveal the double progress bar I will take a look.

please save them as Flash CS5 or lower.

Link to comment
Share on other sites

Hi Carl,

 

PFA the files and pl. let me know what's making the progress bar display twice.

 

Thanks in advance,

abk.

Link to comment
Share on other sites

the problem is in progress movie you have a SWFLoader set up to load fIntro.swf.

 

it looks like this:

 

movClip.append(new SWFLoader("fIntro.swf", { name:"intro", container:this, x:0, y:0, width:900, height:350,autoPlay:false}));

 

note you have autoPlay:false

 

but inside fintro.swf on frame 1 you have a function call for nxtFr() which plays the timeline of fintro.swf, thus making autoPlay:false ineffective.

 

once the timeline of fintro plays it encounters a frame that has a LoaderMax. That LoaderMax has requireWithRoot set to this.root.

 

so what's happening is fintro.swf loads super fast and you see the progress bar jump to 99% then a few moments later the LoaderMax with requireWithRoot informs the parent swf: "Hey buddy, you have a bunch more stuff to load!" and then the progress bar adjusts itself to account for all the new files that it needs to load.

Link to comment
Share on other sites

Thanks a lot Carl :) ... I revised the code and it's working properly now..Your prompt help on the matter is much appreciated!

 

Best regards,

abk

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×