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

**URL:** <https://forum.kirupa.com/t/xml-get-onload-function-to-accept-values-retrieve-the-filename/188720>\
**Category:** flash\
**Created:** [May 10, 2006, 10:51am UTC](https://forum.kirupa.com/t/xml-get-onload-function-to-accept-values-retrieve-the-filename/188720 "2006-05-10T10:51:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CEOofAEP](https://avatars.discourse-cdn.com/v4/letter/c/7cd45c/32.png) [@CEOofAEP](https://forum.kirupa.com/u/CEOofAEP)\
**Post date:** [May 10, 2006, 10:51am UTC](https://forum.kirupa.com/t/xml-get-onload-function-to-accept-values-retrieve-the-filename/188720/1 "2006-05-10T10:51:43Z")

</div>

Hello all.

I am using the standard

```auto
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:

```auto
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 🙂
