Please help me to understand this template of a navigation menu.
I have made comments in the code on things I especially don’t understand.
The template can be downloaded here: (the speaker template). http://www.flashmo.com/preview/flashmo_086_speaker
menu_item_group is a MC.
menu_item is a MC nested inside of menu_item_group.
item_label is a dynamic text field nested inside of menu_item.
menu_item_group.menu_item._visible = false;
var menu_label:Array = new Array("Home", "News", "Portfolio", "Awards", "Company", "Contact");
var total:Number = menu_label.length;
var distance_x:Number = 82;
var i:Number = 0;
for( ; i < total; i++ )
{
menu_item_group.menu_item.duplicateMovieClip("menu_item"+i, i);
menu_item_group["menu_item"+i].over = true; // what is .over ? If i=1 is ["menu_item" + i] equal to .menu_item1 then ?
menu_item_group["menu_item"+i].item_label = menu_label*; // is the instancename changed here or what ? (item_label is a dynamic text field)
menu_item_group["menu_item"+i].item_no = i; // what is item_no ? I can't find any movieclip called item_no in this template.
menu_item_group["menu_item"+i]._x = i * distance_x;
}
function change_page(no):Void // what happens here? Is change_page a function built into AS ?
{
for( i = 0; i < total; i++ )
{
menu_item_group["menu_item"+i].flashmo_button._visible = true;
menu_item_group["menu_item"+i].over = true;
menu_item_group["menu_item"+i].flashmo_button.onRollOver = function()
{
this._parent.over = false; // What happens here? What does _parent refer to ?
}
menu_item_group["menu_item"+i].flashmo_button.onRollOut = menu_item_group["menu_item"+i].flashmo_button.onDragOut = function()
{
this._parent.over = true;
}
menu_item_group["menu_item"+i].flashmo_button.onRelease = function()
{
_root.change_page(this._parent.item_no);
}
menu_item_group["menu_item"+i].onEnterFrame = function()
{
if( this.over == true ) this.prevFrame();
else this.nextFrame();
}
}
delete menu_item_group["menu_item"+no].flashmo_button.onRollOut; // what is "no" ?
menu_item_group["menu_item"+no].flashmo_button._visible = false;
menu_item_group["menu_item"+no].over = false;
_root.page = no + 1;
_root.play();
}
change_page(0);