i have a class named NavMenu that has a static function named createDropDownMenus. inside this function there’s a for loop which loops through an array and does something for each instance inside the array. however, when i try to use this snippet of code inside the for loops, it refuses to work (traces back undefined). outside the loop it works fine.
here’s my code:
the code above the // ^ comments are the pieces that relate to problem
class NavMenu
{
// *
// * Static Member Variables
// *
public static var menu_items:Array = new Array();
// *
// * Static Member Functions
// *
public static function createDropDownMenus()
{
var menu_path = eval(NavMenu.menu_mc_path);
var num_menu_items:Number = NavMenu.menu_items.length;
var num_children = NavMenu.menu_items[1].child_name.length;
// *** ^ Above code works ***
for (var i = 0; i < num_menu_items; i++)
{
var num_children = NavMenu.menu_items*.child_name.length;
// *** ^ Above code does NOT work ***
if (NavMenu.menu_items*.child_name.length > 0)
{
var drop_down_name:String = NavMenu.menu_items*.parent_name;
var num_children:Number = NavMenu.menu_items*.child_name.length;
var submenu_height:Number = 56 + ((num_children - 1) * 7) + (num_children * 7) + 9;
menu_path.createEmptyMovieClip("dd_" + drop_down_name, menu_path.getNextHighestDepth());
with (menu_path["dd_" + drop_down_name])
{
beginFill(0xE3E1CF, 100);
moveTo(0, 0);
lineTo(88, 0);
lineTo(88, 48);
lineTo(106, 48);
lineTo(106, submenu_height);
lineTo(0, submenu_height);
endFill();
}
menu_path["dd_" + drop_down_name]._x = start_x + (NavMenu.margin_x * 2) + 1;
}
}
}
}
any help would be appreciated. thank you,