PDA

View Full Version : Multiple onRollOver-onRollOut on nested MovieClips


lordkiller
07-15-2005, 03:28 PM
As we now, u cant have multiple onRollOver-onRollOut on nested MovieClips becouse they comflict each other, and the use of the hitTest is very unpredictible :( and give some surprising results :)
This apply also for behavoirs as buttons inside of MovieClips.

So here is a prototype to manage this problem(Flash MX).

If u find a better code/way, or can improve this code I want to know. Also if somebody translate to AS2, please post the result.

Templarian
07-15-2005, 04:18 PM
why not this? Yours is way more complicated than it needed to be.

Sry made it in like 2 min so its not as fancy as yours. I just copied over the hit test code i use (i dont use buttons i mostly just use that with with onClipEvent(mouseDown){ actionscript.

lordkiller
07-17-2005, 04:45 PM
First thing: u dont use nested MCs, u put the second MC over the first, not inside...
Second: we are using diferent coding stile, u put code on the MC, Im addept of coding on the _root/main timeline and never have problems with variable scope things :)
Third: something that count when used multiple times: how much calculating is needed:
4 comparisons - use both
2 interogation - width of MC (intrinsec fct. of the player) - your
2 add - _x+width/height - your
1 interogation - getBounds of MC (intrinsec fct. of the player) - myne

Last thing(I give my best but cant figure out...) check example - not working correctly :( is a referencig problem of _global/local coordinates(find "hitArea" of mc2 upwards 200-300 pixels from real position)
Maybee I miss something, try to figure out,pls.
The proto can be used on components... and the fct.s are executed only once on a rollover.

JamniQ
11-14-2007, 06:47 PM
Thanks very much Lordkiller! This is exacly waht i needed!
I have a problem, though. It's kind of noob one but I have to ask for help.
I did my menu based on your project. It's animated one where after rollingOver one MC button appears another one which is inside it. Those MC are not near each other so i have to set hitArea betwen them, but I can't. Part of my code:
band.MultipleRollOver = function() {
logo._alpha = 0;
band.gotoAndStop(2);
band.hitArea = band.area_band & band.area_band2;
band.area_band._alpha = 0;
band.area_band2._alpha = 0;
};

Help!