# Simple but XML to "Global VAR" problem

**URL:** <https://forum.kirupa.com/t/simple-but-xml-to-global-var-problem/326338>\
**Category:** flash\
**Created:** [December 7, 2011, 12:41pm UTC](https://forum.kirupa.com/t/simple-but-xml-to-global-var-problem/326338 "2011-12-07T12:41:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![UserX](https://avatars.discourse-cdn.com/v4/letter/u/c5a1d2/32.png) [@UserX](https://forum.kirupa.com/u/UserX)\
**Post date:** [December 7, 2011, 12:41pm UTC](https://forum.kirupa.com/t/simple-but-xml-to-global-var-problem/326338/1 "2011-12-07T12:41:41Z")

</div>

_ **Hi there, i have a simple problem that is hard for me…** _

I want to reach a XML data (var) from a child movieclip but i couldnt figure out.

I have a movieclip(call it McA) on mainstage that loads a XML.

That XML have this line;  
port\_module\_xml = “xml/portfolio/project/housing\_logos.xml”

McA have this code;

```php

function loadXML(loaded) {
    if (loaded) {
        xmlPath = this.firstChild.childNodes[0].attributes.port_module_xml;
        trace("This Works > " + xmlPath); // Returns "xml/portfolio/project/housing_logos.xml"

    } else {
        content = "file not loaded!";
    }
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("main.xml");

// Everything works till here.

trace("This doesnt work > " + xmlPath); // Returns "undefined"
                  

```

And in McA i have child movieclip(McB) that have this script;

```php

/* 
var xmlDatal = "xml/portfolio/project/housing_logos.xml"; //set xml data file
*/
    var xmlDatal = xmlPath;

            
var xmlObj: XML;
var nodes = new Array();
if (_root.xmlFile!=undefined) xmlDatal = unescape(_root.xmlFile);

init(); 

function init() {
 xmlObj = new XML(xmlDatal); 
 xmlObj.ignoreWhite = true;
 xmlObj.load(xmlDatal);
 this.onEnterFrame = checkXMLprogress;
}

```

\*\*I couldn’t reach \*\*‘xmlPath’ data from child movie clip…  
\*\*

I’m in a really bad situation now, any help will make my day…  
[SIZE=5]Thanks![/SIZE]\*\*
