Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Stefan

Adding a XML to XMLLoader

Recommended Posts

Hi Jack.

I have the following problem.

I have loaded a XML via XMLLoader and included some ImageLoader nodes.

Everything is working fine. I am getting the images from the LoaderMax.getContent ( ... )

and i have the XML-Nodes to get Texts and Links, etc ... from the XML inside LoaderMax.

 

So. the clients system is not working with external XMLs ( he told me after everythings finished ).

Now my plan is to include the XML in an XMLObject inside the SWF to stay in the same structure.

Is there a way to send the XML Object into the XMLLoader?

I have find out that i can give the XMLLoader --> XMLLoader.parseLoaders(). And the LoaderMax

is loading all the Images. That works fine.

But how can i send the full XML to LoaderMax/XMLLoader without loading, so that i can stay in

my builded work. Do you have any ideas or work arounds?

 

Thank you very much.

Stefan.

Link to comment
Share on other sites

That is indeed a pretty odd request :) By its very nature, XMLLoader is supposed to load XML files, so it doesn't accommodate directly setting the XML without loading it and then act as though it did load it (pretend). Hm. I suppose you could extend XMLLoader and do some funky stuff to just dispatch a COMPLETE event immediately when load() is called, and then change what happens in the _receiveDataHandler() method to use your hard-coded XML but that seems hackalicious in a bad way. Imagine someone inheriting your project in 1 year and trying to understand what's going on - "he used an XMLLoader...but it doesn't load anything...wait, where's the data? Why is there this custom flavor of XMLLoader here?"

 

You can, of course, use the static XMLLoader.parseLoaders() to feed in your XML and have it find the LoaderMax-related nodes and create the necessary loaders, dumping them into a LoaderMax queue for you. I realize that wouldn't completely keep your workflow the way it is now, but at least it's a way to leverage your XML.

 

Hope that helps.

Link to comment
Share on other sites

Thanks for your fast response.

I really know, as you say, using an XMLLoader while not loading. :)

I know that. It was only that everything is referring to LoaderMax or

XMLLoader inside the application and i thought to leave the coded

structure as it is now. For me it would be the fastest way to add

the hard-coded XML to XMLLoader, if theres a way to do that.

So. I think i am going to change everything to the included XML.

Thanks, Jack.

Stefan.

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