Why is:
ActionScript Code:
[LEFT][COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"xml..players[0] = "[/COLOR]+ [COLOR=#0000ff]xml[/COLOR]..[COLOR=#000080]players[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"xml…players[0] = "[/COLOR]+ [COLOR=#0000ff]xml[/COLOR]…[COLOR=#000080]players[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#0000ff]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#ff0000]"xml…players.length() = "[/COLOR]+ [COLOR=#0000ff]xml[/COLOR]…[COLOR=#000080]players[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000ff]length[/COLOR]COLOR=#000000[/COLOR][COLOR=#000000])[/COLOR];
[/LEFT]
Outputting :
xml…players[0] = <players>
<player>Rosario Maij</player>
<player>Nathanael Poysti</player>
</players>
xml…players[0] = <players>
<player>Rosario Maij</player>
<player>Nathanael Poysti</player>
</players>
xml…players.length() = 1
How can I get the total amount of <player> for this loop:
ActionScript Code:
[LEFT][COLOR=#0000FF]for[/COLOR] [COLOR=#000000]([/COLOR][COLOR=#000000]**var**[/COLOR] v:[COLOR=#0000FF]Number[/COLOR] = [COLOR=#000080]0[/COLOR]; v < [COLOR=#000000]([/COLOR][COLOR=#0000FF]xml[/COLOR]..[COLOR=#000080]players[/COLOR][COLOR=#000000][[/COLOR][COLOR=#000080]0[/COLOR][COLOR=#000000]][/COLOR].[COLOR=#0000FF]length[/COLOR][COLOR=#000000]([/COLOR][COLOR=#000000])[/COLOR][COLOR=#000000])[/COLOR]; v++[COLOR=#000000])[/COLOR] [COLOR=#000000]{[/COLOR]
[COLOR=#0000FF]trace[/COLOR][COLOR=#000000]([/COLOR][COLOR=#FF0000]"xml..players.player[0] == "[/COLOR]+ [COLOR=#0000FF]xml[/COLOR]..[COLOR=#000080]players[/COLOR].[COLOR=#000080]player[/COLOR][COLOR=#000000][[/COLOR]v[COLOR=#000000]][/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
Thanks
Ian
=====================================================
update:
“myXML.length() doesn’t yield the same as myArray.length. No matter how many child nodes are in your XML object, the length property will be returned as 1.”
- How may I go around this?