Hi all,
I am stuck with developing a xml based menu (based on kirupa’s tutorial).
All the nav links are correct but i am having problems with the background color and placing the submenu nav links.
For the background color i am have created a function drawBG. At the moment i have set the name static, but i realise that sometimes i have 3 submenu.
So i can’t use the same name over and over again. How do i create the names dynamicly for say 3 submenu’s
so i have something, like
mainMenuBG - submainMenuBG - subsubmainMenuBG - subsubsubmainMenuBG
function generateMenuNew(container, name, xPos, yPos, depth, node_xml, bgMenuDepth, bgName) {
var curr_node:XML;
var curr_item:MovieClip;
//important first the background then menu
drawBG(websiteContent.getNextHighestDepth(), "mainMenuBG", 0xE3E3E3, 160, 430, 0, 0, 1);
curr_item.onRelease = function() {
generateSubMenu(curr_menu, "submenu_mc", curr_item._x+websiteContent.mainMenuBG._width, 225, 1000, this.node_xml, 1, 0xFCCBAC);
};
......
}
function generateSubMenu(container, name, x, y, depth, node_xml, animateBG, clrBG) {
var animateBG:Boolean;
var clrBG;
var curr_node:XML;
var curr_item:MovieClip;
var curr_menu = container.createEmptyMovieClip(name, depth);
//boolean animate background
drawBG(1, "submainMenuBG", clrBG, 145, 205, 165, 225, animateBG);
........
}
function drawBG(menuDepth, bgName, bgColor, bgWidth, bgHeight, bgX, bgY, animateBG) {
var animateBG:Boolean;
var menuBG:MovieClip = websiteContent.createEmptyMovieClip(bgName, menuDepth-2);
menuBG.beginFill(bgColor, 100);
menuBG.lineTo(0, bgHeight);
menuBG.lineTo(bgWidth, bgHeight);
menuBG.lineTo(bgWidth, 0);
menuBG.lineTo(0, 0);
menuBG.endFill();
menuBG._x = bgX;
menuBG._y = bgY;
createMask(bgName,bgWidth, bgHeight, bgX, bgY);
menuBG.setMask(thisMask);
if(animateBG == 1){
var showBGTween = TweenLite.from(websiteContent[bgName], 0.7, {_x: -100,_alpha:0, ease:Ease.easeOutBack});
}
}