Hi Flep!
After reading your tutorial about arrays and reading the
multiple gallery xml Slideshow topic again, I begin to understand the need of arrays for this type of thing I want to do. Thank you very much for the help!
Now I have another doubt. Using your example with the
multiple gallery xml Slideshow, in the end of the code, you trace two arrays:
Code:
trace(my_array[3][2]);
At this point, everything is fine!
Still using your example, If I try to trace this:
Code:
trace(my_array[i][j]);
I get a Value, still working!!
When I try to trace the same thing [i][j] using my xml code, the output show me undefined.
I'm posting my AS3 code and the xml code is the same as the first post:
Code:
var menuArray:Array = new Array();
var xmlLoader:URLLoader = new URLLoader();
xmlLoader.load(new URLRequest("arrays.xml"));
xmlLoader.addEventListener(Event.COMPLETE, xmlLoaded);
function xmlLoaded(event:Event):void
{
var xmlLoader:URLLoader = URLLoader(event.target);
var xml:XML = new XML(xmlLoader.data);
var myXML:XMLDocument = new XMLDocument();
myXML.ignoreWhite = true;
myXML.parseXML(xml.toXMLString());
var node:XMLNode = myXML.firstChild;
var itemArray:Array = new Array;
for (var i:int = 0; i < node.childNodes.length; i++)
{
itemArray.push(node.childNodes[i].attributes['NOME']);
var itemSubArray:Array = new Array();
var s:int = node.childNodes[i].childNodes.length;
for (var j:int = 0; j < s; j++)
{
itemSubArray.push(node.childNodes[i].childNodes[j].firstChild.nodeValue);
}
menuArray.push(itemSubArray);
}
menuArray.push(itemArray);
trace(menuArray[i][j]);
}
What is wrong? is the same as file, I only changed the array names.
If I trace this everything goes fine:
Code:
trace(my_array[3][2]);
By the way, I tried to add the top level menu itens and everything works fine, but I'm having problem to add the sub itens when the top level menu is clicked.
There's to many thing to understand...

Hope to get an answer from you soon!!!
Bye!!