Dynamically created XML objects and other fun

Hey Guys,
Im using the following script to load a text string, and generate a new XML object from each variable found in the string:

 ActionScript Code:

var current:Object = new Object [FONT=Courier New][LEFT]currentVars = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]LoadVars[/COLOR]COLOR=#000000[/COLOR];
currentVars.[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=#0000ff]for[/COLOR] [COLOR=#000000]([/COLOR]item [COLOR=#0000ff]in[/COLOR] currentVars[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
current[COLOR=#000000][[/COLOR]item[COLOR=#000000]][/COLOR] = currentVars[COLOR=#000000][[/COLOR]item[COLOR=#000000]][/COLOR];
[COLOR=#0000ff]_root[/COLOR][COLOR=#000000][[/COLOR]item+[COLOR=#ff0000]“XML”[/COLOR][COLOR=#000000]][/COLOR] = [COLOR=#000000]new[/COLOR] [COLOR=#0000ff]XML[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#0000ff]_root[/COLOR][COLOR=#000000][[/COLOR]item+[COLOR=#ff0000]“XML”[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]ignoreWhite[/COLOR] = [COLOR=#000000]true[/COLOR];
[COLOR=#0000ff]_root[/COLOR][COLOR=#000000][[/COLOR]item+[COLOR=#ff0000]“XML”[/COLOR][COLOR=#000000]][/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=#0000ff]trace[/COLOR]COLOR=#000000[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
[COLOR=#0000ff]_root[/COLOR][COLOR=#000000][[/COLOR]item+[COLOR=#ff0000]“XML”[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]load[/COLOR]COLOR=#000000[/COLOR];
[COLOR=#000000]}[/COLOR]

[COLOR=#000000]}[/COLOR] 

[COLOR=#000000]}[/COLOR];
currentVars.[COLOR=#0000ff]load[/COLOR]COLOR=#000000[/COLOR];
[/LEFT]
[/FONT]

This works pretty dandy and trace the loaded XML for each object.

Now for my problem!

 ActionScript Code:
 [FONT=Courier New][LEFT][COLOR=#0000ff]_root[/COLOR][COLOR=#000000][[/COLOR]item+[COLOR=#ff0000]"XML"[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]onLoad[/COLOR] = [COLOR=#000000]**function**[/COLOR][COLOR=#000000]([/COLOR]ok[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
            [COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]ok[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]

[COLOR=#0000ff]trace[/COLOR]COLOR=#000000[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
[/LEFT]
[/FONT]

At this point in my script I want to be able to access some of th enode variables within the XML. when i try to use

 ActionScript Code:
 [FONT=Courier New][LEFT][COLOR=#0000ff]_root[/COLOR][COLOR=#000000][[/COLOR]item+[COLOR=#ff0000]"XML"[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]onLoad[/COLOR] = [COLOR=#000000]**function**[/COLOR][COLOR=#000000]([/COLOR]ok[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
             [COLOR=#0000ff]if[/COLOR][COLOR=#000000]([/COLOR]ok[COLOR=#000000])[/COLOR][COLOR=#000000]{[/COLOR]

[COLOR=#0000ff]trace[/COLOR]COLOR=#000000[/COLOR]
[COLOR=#000000]}[/COLOR]
[COLOR=#000000]}[/COLOR];
[/LEFT]
[/FONT]

it returns an ‘undefined’ value …can anyone help me with suggestions as how to access the loaded XML from this point?

Many thanks,
Zaid