Jump to content
Search Community

LoaderMax.getLoader("loaderName") 'globally'

jho3k test
Moderator Tag

Recommended Posts

Hi Jack,

 

Great work on LoaderMax, it feels really solid.

 

This might be too late but this is something I've noticed that differs from how I'm used to using another popular loading class...

 

A way to access LoaderMax instances by name 'globally'. It'd be great to be able to do this -

 

//in document class:

public var mainLoader:LoaderMax = new LoaderMax({name:"theMainLoader"});

//in some kind of sub class:

var imageLoader:ImageLoader = new ImageLoader("url", {props});

LoaderMax.getLoader("theMainLoader").append(imageLoader);

 

This way it'd be possible to prioritise/pause/etc the loading of all items within the swf from other classes - at the moment i'm using a workaround that is specifying the document class and then accessing the mainLoader that way which works fine but would be great if it was built in..

Link to comment
Share on other sites

That has been built-in from the start actually. You can do exactly that. There are static LoaderMax.getLoader() and LoaderMax.getContent() methods that make it very convenient to get loaders or their content from anywhere in your app.

Link to comment
Share on other sites

Hi Jack,

 

I found that whilst testing the existence of a loader LoaderMax.getLoader("name") was causing a problem the first time so i modified the static function like so:

 

public static function getLoader(nameOrURL:String):LoaderCore {
	if (_globalRootLoader != null) {
		return _globalRootLoader.getLoader(nameOrURL);
	} else {
		return null;
	}
}

 

Cheers

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.
×
×
  • Create New...