Jump to content
Search Community

XML in a Queue Vs new XMLLoader()

matthewwilliams test
Moderator Tag

Recommended Posts

Hello, I want to use my xml file to load swfs into my app. But I was wondering what the sequence of events are? First I tried:

 

_queue= new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});

           _queue.append( new XMLLoader("shared/courseData.xml", {name:"courseData",noCache:true}));    

 

Then I decided that I needed to be notified when the xml was loaded without waiting for the whole queue to load. So I changed the above and added an explicit event listener for the data.xml. They are: onComplete:xmlCompleteHandler, onFail: xmlFailHandler.

 

_queue= new LoaderMax({name:"mainQueue", onProgress:progressHandler, onComplete:completeHandler, onError:errorHandler});

		_queue.append( new XMLLoader("shared/data.xml", {name:"courseData",noCache:true, [b]onComplete:xmlCompleteHandler, onFail: xmlFailHandler[/b]}));		
		_queue.load();

 

Is there a better way to go about this? My goal is to use the very nice feature of LoaderMax which allows me to pull "SWFLoaders" out of my xml doc. For our app's needs we have to have the xml loaded first. If I trace the above out I see that the xmlCompleteHandler fires before the completeHandler. (In the authoring environment). Can I count on that? Is there a better way to do this without having to make 2 separate xml docs? (One for loading swfs and one for the other data the application needs).

 

Thanks.

Link to comment
Share on other sites

Sure, you can count on the nested loader firing its COMPLETE event before its parent LoaderMax. And if you need to sense when ONLY the XML has loaded (not including any parsed loaders it found inside the XML), you can simply listen for the INIT event (or onInit).

 

Does that answer your question?

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