XML: get onLoad-function to accept values / retrieve the filename?

Hello all.

I am using the standard

var xml_group:XML = new XML();
xml_group.ignoreWhite = true;
xml_group.onLoad = loadXMLgroup;

stuff to create an XML handler and a call to the function “loadXMLgroup” to read the data from the XML.

Now, with common, default example code, the way you usually use an XML-handling function is:

function loadXMLgroup(loaded) {
    if (loaded) {
    // do stuff with the XML file
    }
}

…but is there a way to pass a value to it / retrieve the name of the currently processed file from within the XML?

The reason for this is that I want to use the same function (loadXMLgroup) to load several XML files (several groups) and now I am trying to find an “intelligent” way of handling the data.

Before, I did it with a supervising function (with an interval) that checked if a certain “_root” value was filled and if so (or if it failed / time ran out) it would go to the next file to load… but that way it was slow because it would only load one file at a time and wait until it was done, etc…

Is that already the best way to do it? Is there a way how the XML-handling function (loadXMLgroup) can tell which file it is currently processing and fill a specific named value / array-entry instead of a generic dummy value?

Am I explaining this well enough?

Thanks in advance for your help :slight_smile: