Jump to content
Search Community

LoaderMax onRawLoad handler

decaz test
Moderator Tag

Recommended Posts

I think the problem you are facing is that you can't overwrite the content of your XMLLoader.

so you can populate a new XML object with the content (the raw xml) of your XMLLoader and edit that copy.

 

take a look here:

 

import com.greensock.*;
import com.greensock.loading.*;
import com.greensock.events.*;

var localXML:XML;

var xml:XMLLoader = new XMLLoader("data.xml", {onRawLoad:rawHandler});

xml.load();

function rawHandler(e:LoaderEvent):void{
trace("xml done loading original xml \n\n" + e.target.content);
localXML = e.target.content
trace("\nlocalXML is set to \n\n" + localXML);
localXML.appendChild(<foo>hello</foo>);
trace("\nlocalXML has been altered with foo node \n\n" + localXML);
}

this sample will load an external xml file, copy the data, and then append a node to the new xml

 

I have attached my fla and xml file if you want to test it out.

alterLoadedXML.zip

Link to comment
Share on other sites

Thank you. I modified and it is working!

 

Does load=false need to be set? I currently have load=true set. Seems that it shouldn't matter because I am feeding new XML before any of the assets have began loading.

 

Truth?

Link to comment
Share on other sites

Sorry, I don't really understand the full scope of what you are doing, what your original xml looks like or how you are modifying the new xml. My best advice is to experiment with load = true vs false and see which works best for you.

 

If you need a more detailed response feel free to clarify.

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