Jump to content
Search Community

Problem loading LoaderMax XML node on demand

ggritmon test
Moderator Tag

Recommended Posts

I have an XMLLoader which loads an XML containing 2 LoaderMax objects, one with load="true" and one with load="false".


When the XMLLoader triggers onComplete, I start my app and want to request the second LoaderMax to start. When I do this, however, the assets never seem to start loading.


Am I calling things correctly?


// XML

<LoaderMax name="Subload" load="false" childrenVars="autoPlay:false">
	<VideoLoader url="videos/Main/M1.f4v" name="M1MainAnimation" autoDispose="false" />


// AS3
private function _onLoadComplete(e:LoaderEvent):void
  trace("ASSETS LOADED");

  var subLoader:LoaderMax = LoaderMax.getLoader("Subload");
  subLoader.vars = { onProgress:onSubloadProgress }
private function onSubloadProgress(e:LoaderEvent):void

Link to comment
Share on other sites

The problem is this line:

subLoader.vars = { onProgress:onSubloadProgress }


The vars object is really only parsed in the constructor - you can't just add/replace properties after the instance is created (well, you can but they'll be ignored). The solution is to simply use the addEventListener() method to add your listener(s), like:


subLoader.addEventListener(LoaderEvent.PROGRESS, onSubloadProgress);

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