RE: [Flashcoders] Simplify XML Call

2011-08-14 Thread Merrill, Jason
essage- From: flashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of John Polk Sent: Sunday, August 14, 2011 9:40 AM To: Flash Coders List Subject: Re: [Flashcoders] Simplify XML Call > From: Taka Kojima > To: Flash Coders List > Sent: Su

Re: [Flashcoders] Simplify XML Call

2011-08-14 Thread John Polk
> From: Taka Kojima > To: Flash Coders List > Sent: Sunday, August 14, 2011 4:24 AM > Subject: Re: [Flashcoders] Simplify XML Call > function getNumItems(level:int, xml:XML):int{ > var levelXML:XML = xml.menu; > for(var i:int = 0; i < level; i ++){ > levelXML = lev

Re: [Flashcoders] Simplify XML Call

2011-08-14 Thread Taka Kojima
rt Denniston >> Barney Elmington >> Campo Fatigua >> Harpo Oprah >> Hugo Boss >> Benny Elkins >> Sheri Downing >> Marcia Marquez >> Manny Peterson >> Joe Merritt >> >> Jason Merrill >> Instructional Technology Architect II >

Re: [Flashcoders] Simplify XML Call

2011-08-14 Thread Taka Kojima
gt; Harpo Oprah > Hugo Boss > Benny Elkins > Sheri Downing > Marcia Marquez > Manny Peterson > Joe Merritt > > Jason Merrill > Instructional Technology Architect II > Bank of America Global Learning > > > > > > ___ > > > -Or

RE: [Flashcoders] Simplify XML Call

2011-08-13 Thread Merrill, Jason
lashcoders-boun...@chattyfig.figleaf.com [mailto:flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Merrill, Jason Sent: Saturday, August 13, 2011 9:58 PM To: Flash Coders List Subject: RE: [Flashcoders] Simplify XML Call >> Then I think I hit on what Jason was suggesting: Not really. :

RE: [Flashcoders] Simplify XML Call

2011-08-13 Thread Merrill, Jason
ubject: Re: [Flashcoders] Simplify XML Call > From: Henrik Andersson > To: Flash Coders List > 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: "Yo

Re: [Flashcoders] Simplify XML Call

2011-08-13 Thread John Polk
> From: Henrik Andersson > To: Flash Coders List > 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

Re: [Flashcoders] Simplify XML Call

2011-08-13 Thread Henrik Andersson
There is still no eval function. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] Simplify XML Call

2011-08-13 Thread Karl DeSaulniers
] Simplify XML Call ActionScript 3 is a compiled language. There is no such thing as an eval function in as 3. Well, that's the crux of my problem, Henrik. How do I get around writing code that adds just the right number of "item units" without doing it as a string to evalua

Re: [Flashcoders] Simplify XML Call

2011-08-13 Thread John Polk
> From: Henrik Andersson > To: Flash Coders List > Sent: Friday, August 12, 2011 1:43 PM > Subject: Re: [Flashcoders] Simplify XML Call > > ActionScript 3 is a compiled language. There is no such thing as an eval > function in as 3. Well, that's the crux of my pro

Re: [Flashcoders] Simplify XML Call

2011-08-12 Thread Henrik Andersson
ActionScript 3 is a compiled language. There is no such thing as an eval function in as 3. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Re: [Flashcoders] Simplify XML Call

2011-08-12 Thread John Polk
I appreciate Ktu's efforts here; however, Merrill is right. I've written this:                         var j:String = "xml.menu.item[whichItems[0]]";             var k:String = new String();             var l:int = level;             while (l--)             {                 k += ".item[whichItems

RE: [Flashcoders] Simplify XML Call

2011-08-11 Thread Merrill, Jason
>>(I try not to do more than people ask for. It's easy to get sucked into >>solving a larger problem than was asked) Yes, I agree totally, that can be a problem for sure. >> - apparently he already knows how deep to go. his original post said "switch >> (level) {" Yeah, understood. I was just

Re: [Flashcoders] Simplify XML Call

2011-08-11 Thread Ktu
merica Global Learning > > > > > > ___ > > > -Original Message- > From: flashcoders-boun...@chattyfig.figleaf.com [mailto: > flashcoders-boun...@chattyfig.figleaf.com] On Behalf Of Ktu > Sent: Thursday, August 11, 2011 2:14 PM > To: Flash Coders

RE: [Flashcoders] Simplify XML Call

2011-08-11 Thread Merrill, Jason
half Of Ktu Sent: Thursday, August 11, 2011 2:14 PM To: Flash Coders List Subject: Re: [Flashcoders] Simplify XML Call "that would be limited to you hard coding the number of levels to go down to" - he already had this level var created with whatever number he had intended, I was just givi

Re: [Flashcoders] Simplify XML Call

2011-08-11 Thread Ktu
"that would be limited to you hard coding the number of levels to go down to" - he already had this level var created with whatever number he had intended, I was just giving an example value... " If the XML gets larger and deeper, that function would fail... " - why would it fail? (assuming that

Re: [Flashcoders] Simplify XML Call

2011-08-11 Thread Henrik Andersson
While you have the right spirit I think that it would be a better idea to check the length of the array instead. That way you won't accidentally step out of bounds there. ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.f

RE: [Flashcoders] Simplify XML Call

2011-08-11 Thread Merrill, Jason
: Re: [Flashcoders] Simplify XML Call sorry should have been this: var level:int = 5; var xmlItem:* = xml.menu; for (var i:int = 1; i < level; i++) { xmlItem = xmlItem.item[this["whichItem" + ((i == 1) ? "" : i)]]; } totalItems = xmlItem.item.l

Re: [Flashcoders] Simplify XML Call

2011-08-11 Thread Ktu
sorry should have been this: var level:int = 5; var xmlItem:* = xml.menu; for (var i:int = 1; i < level; i++) { xmlItem = xmlItem.item[this["whichItem" + ((i == 1) ? "" : i)]]; } totalItems = xmlItem.item.length; On Thu, Aug 11, 2011 at 11:54 AM, Ktu wrote: >

Re: [Flashcoders] Simplify XML Call

2011-08-11 Thread Ktu
*UNTESTED*, but this was my thought... var level:int = 5; var xmlItem:* = xml.menu; for (var i:int = 0; i < level; i++) { xmlItem = xmlItem.item[this["whichItem" + ((i == 0) ? "" : i)]]; } totalItems = xmlItem.item.length; I am doing this: ["whichItem" + ((i == 0)

RE: [Flashcoders] Simplify XML Call

2011-08-11 Thread Merrill, Jason
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. The function basically checks the XML node to see if it has any children. If it does, it calls itself,