I’ve done some research on targeting nested movie clips so that an event such as “onRollOver” will activate appropriate actions within both nested clips and their parents and I found a tutorial - http://www.senocular.com/flash/tutorials/buttoncapturing/ - which I’ve tried to adapt with limited success. Hopefully someone here might be able to tell me where I’m going wrong.
I want to build a menu which is divided into 5 sections. When the user rolls over one of the sections (“menu1”) the top level menu option in that section (“M1”) should move up within the section, leaving room for the submenu options (“M1_S1” & “M1_S2”) to fade in below it. I’ve uploaded one of the sections to 4shared.com if anyone wants to have a look:
http://www.4shared.com/file/64402090/83809e35/Menu.html
Here is the script I’ve applied:
[INDENT]*menu1.onRollOverHandler = function() {
if (menu1.M1._y>46) {
menu1.M1._y -= 8;
}
if (menu1.M1_S1._alpha<100) {
menu1.M1_S1._alpha += 10;
}
if (menu1.M1_S2._alpha<100) {
menu1.M1_S2._alpha += 10;
}
};
menu1.onRollOutHandler = function() {
if (menu1.M1._y<86) {
menu1.M1._y += 8;
}
if (menu1.M1_S1._alpha>0) {
menu1.M1_S1._alpha -= 10;
}
if (menu1.M1_S2._alpha>0) {
menu1.M1_S2._alpha -= 10;
}
};
// delegate to all children
menu1.M1.onRollOver = function() {
menu1.onRollOverHandler();
};
menu1.M1_S1.onRollOver = function() {
menu1.onRollOverHandler();
menu1.M1_S1.gotoAndPlay(“RollOver”);
};
menu1.M1_S1.onRollOut = function() {
menu1.onRollOverHandler();
menu1.M1_S1.gotoAndPlay(“RollOut”);
};
menu1.M1_S2.onRollOver = function() {
menu1.onRollOverHandler();
menu1.M1_S2.gotoAndPlay(“RollOver”);
};
menu1.M1_S2.onRollOut = function() {
menu1.onRollOverHandler();
menu1.M1_S2.gotoAndPlay(“RollOut”);
};
menu1.menuBG.onRollOver = function() {
menu1.onRollOverHandler();
};
menu1.menuBG.onRollOut = function() {
menu1.onRollOutHandler();
};
*[/INDENT]What happens is, instead of M1 moving all the way up to y=46 when you roll over the section, it stops after moving 8 pixels unless you roll over one of the menu options within the section. On top of that, the onRollOut function (which would fade out the sub menu options and bring M1 back to it’s original position) doesn’t seem to be working either.
Maybe I’m making a very simple mistake but I cannot for the life of me figure it out. Any help would be greatly appreciated. Thanks, Brian.