when you have many buttons and each one does something else, there's not too much to do about it.
But in your case, use a function for all your menu items.
// first part of code remains the same
function EnableFotosMC(bEnable)
{
_root.menu_mc.fotos_mc.enabled = bEnable;
_root.menu_mc.fotos_mc._visible = bEnable;
}
_root.menu_mc.textoBtn_mc.onRelease = _root.menu_mc.fotosBtn_mc.onRelease = _root.menu_mc.contactosBtn_mc.onRelease = function()
{
this.enabled = false;
EnableFotosMC(true);
}
_root.menu_mc.menuFotos_mc.wagonBtn_mc.onRelease = _root.menu_mc.menuFotos_mc.maratBtn_mc.onRelease = _root.menu_mc.menuFotos_mc.viktBtn_mc.onRelease = _root.menu_mc.menuFotos_mc.spidBtn_mc.onRelease = _root.menu_mc.menuFotos_mc.visBtn_mc.onRelease = _root.menu_mc.menuFotos_mc.outrBtn_mc.onRelease = EnableFotosMC(true);
// the rest remain the same ...
- // first part of code remains the same
- function EnableFotosMC(bEnable)
- {
- _root.menu_mc.fotos_mc.enabled = bEnable;
- _root.menu_mc.fotos_mc._visible = bEnable;
- }
- _root.menu_mc.textoBtn_mc.onRelease = _root.menu_mc.fotosBtn_mc.onRelease = _root.menu_mc.contactosBtn_mc.onRelease = function()
- {
- this.enabled = false;
- EnableFotosMC(true);
- }
- _root.menu_mc.menuFotos_mc.wagonBtn_mc.onRelease = _root.menu_mc.menuFotos_mc.maratBtn_mc.onRelease = _root.menu_mc.menuFotos_mc.viktBtn_mc.onRelease = _root.menu_mc.menuFotos_mc.spidBtn_mc.onRelease = _root.menu_mc.menuFotos_mc.visBtn_mc.onRelease = _root.menu_mc.menuFotos_mc.outrBtn_mc.onRelease = EnableFotosMC(true);
- // the rest remain the same ...
another thing you could do, would be to load the menu either from a hardcoded array or from an xml file, and create it dynamic, thus you will have:
for (iMainMenuIndex = 0; iMainMenuIndex <nMainMenuCount; iMainMenuIndex ++)
{
crtMainMenu = _root.menu_mc.mainMenu[iMainMenuIndex];
for (iMenuItemIndex = 0; iMenuItemIndex<nMenuItemCount; iMenuItemIndex++)
{
crtMainMenu.menuItem[menuItemIndex].onRelease = function()
{
// function code here
}
}
}
- for (iMainMenuIndex = 0; iMainMenuIndex <nMainMenuCount; iMainMenuIndex ++)
- {
- crtMainMenu = _root.menu_mc.mainMenu[iMainMenuIndex];
- for (iMenuItemIndex = 0; iMenuItemIndex<nMenuItemCount; iMenuItemIndex++)
- {
- crtMainMenu.menuItem[menuItemIndex].onRelease = function()
- {
- // function code here
- }
-
- }
- }
There are lots of things you could do ... you just need to practice more.
“True mastery transcede any particular art. It stems from mastery of oneself - the ability, developed throgh self-discipline, to be calm, fully aware, and complety in tune with oneself and the surroundings. Then, and only then, can a person know himself. ”