I am trying to access to a simple nested Array, doing this:
var currMenu = 1;
while ( currMenu < menu.length ) {
alert(currMenu);
alert(menu[0][currMenu].text);
currMenu++;
}
Despite alerts are throwing the correct values, I am getting this error on firebug: TypeError: menu[0][currMenu] is undefined.
What is happening?
Thanks!
Edit: Sorry, I was rushing, here you have the "menu" structure:
menu[0] = new Array();
menu[0][0] = new Menu(false, '', 15, 50, 20, '','' , 'navlink', 'navlink');
menu[0][1] = new Item('someText', '#', '', 100, 10, 1);
And the object Item:
function Item(text, href, frame, length, spacing, target) {
this.text = text;
if (href == '#') {
this.href = '#';
} else if (href.indexOf('http') == 0) {
this.href = href;
} else this.href = href;
this.frame = frame;
this.length = length;
this.spacing = spacing;
this.target = target;
// Reference to the object's style properties (set later).
this.ref = null;
this.showLoadingBar = false;
}
menu[currMenu].text?