# Passing the value of an attribute to a \_global variable

**URL:** <https://forum.kirupa.com/t/passing-the-value-of-an-attribute-to-a--global-variable/236830>\
**Category:** Uncategorized\
**Created:** [August 23, 2007, 11:45pm UTC](https://forum.kirupa.com/t/passing-the-value-of-an-attribute-to-a--global-variable/236830 "2007-08-23T23:45:37Z")\
**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 23, 2007, 11:45pm UTC](https://forum.kirupa.com/t/passing-the-value-of-an-attribute-to-a--global-variable/236830/1 "2007-08-23T23:45:37Z")

</div>

hello and help,

i’ve been stuck on this for ages and i can’t find any information to help me.  
I need to pass the value of a attribute to a \_global variable that can be accessed somewhere else in the movie.But it traces as undefined outside of onLoad.

eg. **FRAME ONE**

```
ActionScript Code:
[FONT=Courier New][LEFT][COLOR=#000000] **var** [/COLOR] [COLOR=#0000FF]xml[/COLOR]:XML = [COLOR=#000000] **new** [/COLOR] [COLOR=#0000FF]XML[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR];

```

[COLOR=#0000FF]xml[/COLOR].[COLOR=#0000FF]ignoreWhite[/COLOR] = [COLOR=#000000] **true** [/COLOR];  
[COLOR=#0000FF]xml[/COLOR].[COLOR=#0000FF]onLoad[/COLOR] = [COLOR=#000000] **function** [/COLOR]COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#0000FF]if[/COLOR] COLOR=#000000[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#000000] **var** [/COLOR] theStage = [COLOR=#0000FF]this[/COLOR].[COLOR=#0000FF]firstChild[/COLOR].[COLOR=#0000FF]childNodes[/COLOR];  
numOfStages = theStage.[COLOR=#0000FF]length[/COLOR];  
[COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000] **var** [/COLOR] i = [COLOR=#000080]0[/COLOR]; i\<numOfStages; i++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]  
[COLOR=#808080]_////the attribute i’m TRYING to pass_[/COLOR]  
[COLOR=#000000] **\_global** [/COLOR].[COLOR=#000080]renewalURL[/COLOR] = theStage[COLOR=#000000][[/COLOR][COLOR=#000080]1[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000FF]attributes[/COLOR].[COLOR=#000080]pageURL[/COLOR];

[COLOR=#000000]}[/COLOR]  
[COLOR=#000000]}[/COLOR]  
[/LEFT]  
[/FONT]

**FRAME TWO**  
ActionScript Code:  
[FONT=Courier New][LEFT][COLOR=#808080]\*///// traces as undefined \*[/COLOR]  
[COLOR=#0000FF]trace[/COLOR]COLOR=#000000[/COLOR]  
[/LEFT]  
[/FONT]

please help
