var navArray = ["簡歷","作品展示","學習中心","聯絡我吧","友情連結"]
// correct colors in menu
function setupMenu () {
// colors
BaseColor = 0x414042;
RolloverColor = 0xCCC2C0;
SelectedColor = 0xF15B40;
// buttons
for (var i=1; i<=5; ++i) {
// assign item id
nav_menu["item_"+i].num = i;
nav_menu["item_"+i]._txt.text = navArray[i-1];
nav_menu["item_"+i].hit_btn._width = nav_menu["item_"+i]._txt.textWidth+5;
// Set original Color
var c = new Color(nav_menu["item_"+i]);
c.setRGB(BaseColor);
// Set RollOver color state for all buttons
nav_menu["item_"+i].onRollOver =function () {
var c = new Color(this);
c.setRGB(RolloverColor);
}
// Set RollOut color state for all buttons
nav_menu["item_"+i].onRollOut =nav_menu["item_"+i].onReleaseOutside = function () {
var c = new Color(this);
c.setRGB(BaseColor);
}
// Set Click color state for all buttons
nav_menu["item_"+i].onRelease = function () {
// call switch function
switchActiveColor(this.num);
}
}
}
// navigation
function switchActiveColor(num) {
// Set current selection
currentSelection = num;
// ALl buttons
for (var i=1; i<=5; ++i) {
nav_menu["item_"+i].enabled = true;
var c = new Color(nav_menu["item_"+i]);
c.setRGB(BaseColor);
if (i==num) {
nav_menu["item_"+i].enabled = false;
c.setRGB(SelectedColor);
}
}
}
setupMenu();