/ Published in: ActionScript 3
Run through infinite xml child nodes.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package com.dxc381{ //import flash classes import flash.display.Sprite; public class InfiniteMenu extends Sprite{ private var level:int = -1; public function InfiniteMenu(menuXml){ findSubs(menuXml.item);//pass in lowest level node called item } private function findSubs(subXml):void{ level++; var numOfItems:int = subXml.length(); for(var i:int = 0;i<numOfItems;i++){ trace(level +subXml[i].@itemId); if(subXml[i].item.length() > 0)findSubs(subXml.item);//if there are children } level--; } } }