Share Posted August 7, 2012 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 <GameAssets> <LoaderMax name="Subload" load="false" childrenVars="autoPlay:false"> <VideoLoader url="videos/Main/M1.f4v" name="M1MainAnimation" autoDispose="false" /> </LoaderMax> </GameAssets> // AS3 private function _onLoadComplete(e:LoaderEvent):void { trace("ASSETS LOADED"); var subLoader:LoaderMax = LoaderMax.getLoader("Subload"); subLoader.vars = { onProgress:onSubloadProgress } subLoader.load(); } private function onSubloadProgress(e:LoaderEvent):void { trace("THIS NEVER HAPPENS?"); } Link to comment Share on other sites More sharing options...
Share Posted August 8, 2012 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 More sharing options...
Author Share Posted August 8, 2012 This worked like a charm. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now