# Global variables problem

**URL:** <https://forum.kirupa.com/t/global-variables-problem/236618>\
**Category:** Uncategorized\
**Created:** [August 22, 2007, 9:47am UTC](https://forum.kirupa.com/t/global-variables-problem/236618 "2007-08-22T09:47:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![camoconnell\_com](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/camoconnell_com/32/3655_2.png) [@camoconnell\_com](https://forum.kirupa.com/u/camoconnell_com)\
**Post date:** [August 22, 2007, 9:47am UTC](https://forum.kirupa.com/t/global-variables-problem/236618/1 "2007-08-22T09:47:18Z")

</div>

Hi there,

I’ve been trying to get these variables that are defined inside this XML Array, outside of the XML array using \_global, so that i can use them else where in the animation, but i’m not getting any purchase. PLs help.

[AS]var xml:XML = new XML();  
xml.ignoreWhite = true;  
xml.onLoad = function(success) {  
if (success) {  
var theStage = this.firstChild.childNodes;  
numOfStages = theStage.length;  
for (var i = 0; i\<numOfStages; i++) {

///////////////////// Stage - Renewal  
\_global.renewalTitle = theStage[0].attributes.Title;  
\_global.renewalPath = theStage[0].attributes.path;  
\_global.renewalLHImgOne = theStage[0].firstChild.attributes.image;  
\_global.renewalLHImgTwo = theStage[0].childNodes[1].attributes.image;  
\_global.renewalRHImgOne = theStage[0].childNodes[2].attributes.image;  
\_global.renewalRHImgTwo = theStage[0].childNodes[3].attributes.image;  
\_global.renewalInfo = theStage[0].firstChild.firstChild;  
\_global.renewalLHImgTwoInfo = theStage[0].childNodes[1].firstChild;  
\_global.renewalRHImgOneInfo = theStage[0].childNodes[2].firstChild;  
\_global.renewalRHImgTwoInfo = theStage[0].childNodes[3].firstChild;

// …etc

}  
} else {  
\_root.castMC.StagesWrap.homeMC.homeFooter\_txt.text = “Error loading XML file”;  
}  
};  
// load the xml  
xml.load(“headerData.xml”);

// And Below i’m trying to retrieve the global variables defined in the arrays, but it’s just not working

\_root.Renewal.renewalBG.createEmptyMovieClip(“renewalLHImgOne\_MC”, 50);  
\_root.Renewal.renewalBG.renewalLHImgOne\_MC.loadMovie(serverPath+renewalPath+renewalLHImgOne);  
\_root.Renewal.renewalBG.createEmptyMovieClip(“renewalRHImgTwo\_MC”, 51);  
\_root.castMC.StagesWrap.Renewal.renewalBG.renewalRHImgTwo\_MC.loadMovie(serverPath+renewalPath+renewalRHImgTwo);  
\_root.Renewal.createEmptyMovieClip(“renewalRHImgOne\_MC”, 53);  
\_root.Renewal.renewalRHImgOne\_MC.loadMovie(serverPath+renewalPath+renewalRHImgOne);  
[/AS]

:o if anyone could help, it’d be much appreciated

Thanks  
Cam
