Jump to content
GreenSock

polonDev

Pause self .swf

Recommended Posts

Hello,

 

I would like to pause (self swf + other stuff) to simply force to start downloading my preloader image first before others stuff what I append to LoderMax.

 

Because all of my requests to download are downloaded in parallel which cause to slow down downloading of my first (preloader image) what I need to download ASAP.

 

I have in document class constructor:

 

 

LoaderMax.activate([imageLoader, XMLLoader, SelfLoader]);

__queue = new LoaderMax({onProgress:ProgressHandler, onComplete:AllComplete});
__queue.append(new ImageLoader("preloader.jpg", {onComplete:PreloaderImageLoaded, estimatedBytes:134749, name:"preloader"}));
__queue.append(new ImageLoader("assets/Main.png", {estimatedBytes:2865271}));
__queue.append(new SelfLoader(this, {onProgress:OnTest}));

LoaderMax.getLoader("preloader").prioritize();
__queue.load();

 

prioritize() doesn't help me. Still downloading in parallel.

 

Is it possible ?

Link to comment
Share on other sites

Hi and Welcome to the GreenSock forums,

 

I'm having a bit of a difficult time understanding your question. I think what you need is to set MaxConnections to 1 so that only 1 asset will load at a time.

 

__queue = new LoaderMax({onProgress:ProgressHandler, maxConnections:1, onComplete:AllComplete});

 

Does that help?

Link to comment
Share on other sites

Unfortunately not.

If I add parameter onProgress:OnPreloaderProgress

 

__queue.append(new ImageLoader("preloader.jpg", {onComplete:PreloaderImageLoaded, onProgress:OnPreloaderProgress, estimatedBytes:134749, name:"preloader"}));

 

and than I have :

 

 

private function OnPreloaderProgress(e:LoaderEvent):void
{
var Percent:Number = Math.round(e.target.progress * 100);
trace("PRELOADER: " + Percent);
}

private function OnTest(e:LoaderEvent):void
{
var Percent:Number = Math.round(e.target.progress * 100);
trace("SWF: " + Percent);
}

 

 

It's loaded in parallel. So my output is something like:

 

 

RELOADER: 0

SWF: 3

PRELOADER: 1

SWF: 4

PRELOADER: 2

SWF: 4

PRELOADER: 2

SWF: 4

PRELOADER: 3

SWF: 4

PRELOADER: 4

SWF: 4

PRELOADER: 5

SWF: 4

PRELOADER: 5

SWF: 4

PRELOADER: 6

SWF: 5

PRELOADER: 7

SWF: 5

PRELOADER: 8

SWF: 5

 

--> If I use "Simulate download" in Flash Player.

Link to comment
Share on other sites

My apologies, I did not realize that a SelfLoader was involved.

I'm quite certain that there is nothing you can do to prevent a swf from continuing its own loading progress.

SelfLoader simply reports the loading progress of the swf in which the SelfLoader resides. It doesn't actually load anything. The loading is already happening naturally.

 

It sounds like you are going to have to re-architect your project so that you have a very light-weight container swf that loads all the assets for your app:

 

 

__queue = new LoaderMax({onProgress:ProgressHandler, onComplete:AllComplete, maxConnections:1});
__queue.append(new ImageLoader("preloader.jpg", {onComplete:PreloaderImageLoaded, estimatedBytes:134749, name:"preloader"}));
__queue.append(new ImageLoader("assets/Main.png", {estimatedBytes:2865271}));

//new use a SWFLoader to load the file that currently is self
__queue.append(new SWFLoader(someSwfThatUsedToBeTheSelfSwf, {onProgress:OnTest}));

Link to comment
Share on other sites

Ah. I understand now.

So I just create new Project with only document class which load the second SWF(external) where I have all classes what I need in project right ?

 

Thanks for reply

Link to comment
Share on other sites

Yes, sounds like you got it.

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.
×