> From: Henrik Andersson <[email protected]>
> To: Flash Coders List <[email protected]>
> Sent: Saturday, August 13, 2011 3:37 PM
> Subject: Re: [Flashcoders] Simplify XML Call
>
> There is still no eval function.
I know there is no eval fn. Jason Merrill earlier wrote: "You just need a
recursive loop to do this. So I would write a function
that handles each node level individually, adding to a class-level
private property called something like, _totalItems." I tried googling [as3
"recursive loop" xml node] without much luck. Then I think I hit on what Jason
was suggesting:
var x:*;
x = xml.menu.item[whichItems[0]];
var levelsLeft:int = level - 2;
var q:int = 4;
while(levelsLeft--)
{
x = x.item[whichItems[q]];
q--;
}
trace('xxx', x.item.length());
The problem is that for reasons that don't bear explaining I'm not ready to
test this beyond the first level today :-} But I think it (or some tweak)
should work (and I'll clean out that wildcard var).
Thanks,
John
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders