Hi,
I am not sure you can count the sub-nodes without having some sort
of differentiator between parent nodes.
You might have to loop through the list of games to find how many
users are in each one as your tests for 2 & 3 are returning the total
number of "user" nodes in the tree.
You can test your e4x stuff quite nicely here:
http://www.linkwerk.com/pub/javascript/e4x/e4x-tester/
Glen
Alexander Farber wrote:
Hello,
my server delivers XML data over socket,
representing games, with up to 3 players in each.
In my custom component I'd like to display
a summary: total number of games,
number of full games (3 players)
number of vacant games (joinable, because less than 3 players).
I've prepared a reduced test case demonstrating my problem:
var games:XML =
<games>
<game>
<user/>
<user/>
<user/>
</game>
<game>
<user/>
<user/>
</game>
<game>
<user/>
<user/>
</game>
</games>;
trace("All games: " + games.game.length());
trace("Full games: " + games.game.user.(length() == 3).length());
trace("Vacant games: " + games.game.user.(length() < 3).length());
It prints wrong results for the 2 last calculations:
All games: 3
Full games: 0
Vacant games: 7
And a warning:
Warning: 1060: Migration issue: The method length is no longer
supported. Use the length property of the argument instead..
Please advise me
Alex
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders