Jump to content


Loadermax cancel all loaders in progress?

Moderator Tag

Recommended Posts


Just wondering what I may be doing incorrectly here. Lets say I start a loader and it has maxConnections set to 1, so it basically just works as a sequential loader (of images). What if, halfway through the loading, I want to basically stop that loader, clear it's contents and reinitialize it with new content?


I thought I was doing it correctly by calling:


then to re-init, I just create it again:

myLoader = new LoaderMax({all my params for this loader})

After I cancel, I also remove the images from the displayobject like so:

while (_largeImageContainer.numChildren) _largeImageContainer.removeChildAt(0)


If the loaders aren't complete, it doesn't kill the loaders in progress and I get a bunch of errors like so:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Function/()
at Function/()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.greensock.loading.core::LoaderCore/_passThroughEvent()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at com.greensock.loading.core::LoaderCore/_completeHandler()


Plus, when I start the new loader, some of the old images get pushed into the new displayobject. Perhaps I'm not using cancel() in the proper way? Should I be using empty() or remove() instead? And if so, how?

Link to comment
Share on other sites

I don't see any obvious problems in what you described - can you post a very simple FLA that demonstrates the problem? It sounds like you have something going on in the anonymous functions you created. And you are using the latest version of the LoaderMax classes, right?


Oh, and for the record, if you're trying to dump all the loaders in that LoaderMax (cancel them and not reuse them), dispose(true) would be better than cancel() because it would also kill/destroy the LoaderMax instance itself. Not that there's anything wrong with using cancel() - that shouldn't cause errors.

Link to comment
Share on other sites

So, I switched them to dispose() and it seems to work as expected. It also got rid of the Type error. Turns out I had a little too much going on to begin with and had another area that was dependent on the loading of each loaders assets, so when cancel failed it took down another area. I updated and between that and dispose() it works great now. Thanks for the reply on it btw!

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.