# Need help making XML.onLoad return a value

**URL:** <https://forum.kirupa.com/t/need-help-making-xml-onload-return-a-value/250417>\
**Category:** flash\
**Created:** [January 29, 2008, 12:21pm UTC](https://forum.kirupa.com/t/need-help-making-xml-onload-return-a-value/250417 "2008-01-29T12:21:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jonnyleeharris](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@jonnyleeharris](https://forum.kirupa.com/u/jonnyleeharris)\
**Post date:** [January 29, 2008, 12:21pm UTC](https://forum.kirupa.com/t/need-help-making-xml-onload-return-a-value/250417/1 "2008-01-29T12:21:12Z")

</div>

After using Google and these forums I’ve discovered that it’s not possible to return a value directly from this function. However, I still need some kind of workaround, so here is my scenario:

This function overrides the default onLoad function when I load up my XML. It works perfectly.

```php

xmlContent.onLoad = function (success) {  
        
        if (success) {
                //trace("XML Fetch Success");
                xmlContent = xmlContent.firstChild.firstChild.firstChild;
                                
                for (x in xmlContent.childNodes)
                {                    
                    if (xmlContent.childNodes[x].nodeName == "Content")
                    {                        
                        sContent = xmlContent.childNodes[x].firstChild;
                    }
                }                
        }
        else
        {
            sContent = "Error";            
        }        
        
                
};

```

I want to somehow use this functionality to return the value of sContent when it is loaded, so I can use the line

```php
returnContent(x)

```

in conjunction with the following function

```php
function returnContent(Nume) {

    xmlContent.load(x);

}

```

to return a string from the xml on an on load event.

I.e. -

on mouseclick, a texfield.text variable is assigned to returnContent(x);

Thanks for any help that is to follow. This is extremely desperate for a project I’m working on ☹
