Re: [Flashcoders] Xml menu recursion - AS3 - SOLVED
Yes, it should be child.title instead, and I am sure I tried that many a times, but for some reason it only works after posting it on the forum. He he. Thanks for your help nevertheless Kenneth and Matt. On 8/27/08 5:18 PM, "Kenneth Kawamoto" <[EMAIL PROTECTED]> wrote: > Shouldn't it be "trace(child.title);" instead? > > Kenneth Kawamoto > http://www.materiaprima.co.uk/ > > Vayu Robins wrote: >> Hi. >> >> I am trying to build a dynamic menu system with unlimited submenus. >> >> I have this from Colin Moock's book (Essential AS3) and it works fine. >> >> var xml:XML = >> >> >> Menu1 >> >> Menu1 - Sub >> >> Menu1 Sub Sub >> >> >> >> ; >> >> var xmlList:XMLList = xml.children(); >> parseStructure(xmlList); >> function parseStructure(xml:XMLList):void >> { >> for each (var child:XML in xml) >> { >> trace(xml.title); >> if (child.section != null) parseStructure(child.section); >> } >> } >> >> The problem for me arises when I add another section of menus like this: >> >> var xml:XML = >> >> >> Menu1 >> >> Menu1 - Sub >> >> Menu1 Sub Sub >> >> >> >> >> >> Menu2 >> >> Menu2 - Sub >> >> Menu2 Sub Sub >> >> >> >> ; >> >> Is it the xml that is wrong? >> >> Thanks >> Vayu > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Xml menu recursion - AS3
I just tried your code and it works fine for me. Can you elaborate on the problem you're having? .m On Wed, Aug 27, 2008 at 10:54 AM, Vayu Robins <[EMAIL PROTECTED]> wrote: > Hi. > > I am trying to build a dynamic menu system with unlimited submenus. > > I have this from Colin Moock's book (Essential AS3) and it works fine. > > var xml:XML = > > >Menu1 > >Menu1 - Sub > >Menu1 Sub Sub > > > >; > > var xmlList:XMLList = xml.children(); > parseStructure(xmlList); > function parseStructure(xml:XMLList):void > { >for each (var child:XML in xml) >{ >trace(xml.title); >if (child.section != null) parseStructure(child.section); >} > } > > The problem for me arises when I add another section of menus like this: > > var xml:XML = > > >Menu1 > >Menu1 - Sub > >Menu1 Sub Sub > > > > > >Menu2 > >Menu2 - Sub > >Menu2 Sub Sub > > > >; > > Is it the xml that is wrong? > > Thanks > Vayu > ___ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Re: [Flashcoders] Xml menu recursion - AS3
Shouldn't it be "trace(child.title);" instead? Kenneth Kawamoto http://www.materiaprima.co.uk/ Vayu Robins wrote: Hi. I am trying to build a dynamic menu system with unlimited submenus. I have this from Colin Moock's book (Essential AS3) and it works fine. var xml:XML = Menu1 Menu1 - Sub Menu1 Sub Sub ; var xmlList:XMLList = xml.children(); parseStructure(xmlList); function parseStructure(xml:XMLList):void { for each (var child:XML in xml) { trace(xml.title); if (child.section != null) parseStructure(child.section); } } The problem for me arises when I add another section of menus like this: var xml:XML = Menu1 Menu1 - Sub Menu1 Sub Sub Menu2 Menu2 - Sub Menu2 Sub Sub ; Is it the xml that is wrong? Thanks Vayu ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
[Flashcoders] Xml menu recursion - AS3
Hi. I am trying to build a dynamic menu system with unlimited submenus. I have this from Colin Moock's book (Essential AS3) and it works fine. var xml:XML = Menu1 Menu1 - Sub Menu1 Sub Sub ; var xmlList:XMLList = xml.children(); parseStructure(xmlList); function parseStructure(xml:XMLList):void { for each (var child:XML in xml) { trace(xml.title); if (child.section != null) parseStructure(child.section); } } The problem for me arises when I add another section of menus like this: var xml:XML = Menu1 Menu1 - Sub Menu1 Sub Sub Menu2 Menu2 - Sub Menu2 Sub Sub ; Is it the xml that is wrong? Thanks Vayu ___ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders