PDA

View Full Version : movieClips in movieClip MOUSE_OVER



General Tso
August 11th, 2009, 08:38 PM
I have a square movieClip that expands into other movieClip options with a MOUSE_OVER. This works no problem. I drew an invisible rectangle underneath all of these options so that they would stay open when I moved the mouse towards them.

But when I try to code the first option to also work with MOUSE_OVERs and CLICKs it causes problems. At first when I tested the movie it looked fine until I tried to MOUSE_OVER the first new option - the new option produced no results. I think this was because the original invisible rectangle was on top of it.

So I changed the order of layers so the invisible rectangle was on bottom. Then as soon as I tried the new option, the entire original movieClip collapsed back to its original state. I assume that the area beneath the new option was being covered up, and thus my MOUSE_OVER (on the original movieClip) no longer registered.

I then tried adding code to tell the original movieClip to also listen for a MOUSE_OVER on the new option. This worked - I could move the mouse over the new option and the original movieClip remained open, but the old problem of the new option not registerring occurred. I think my new code overrided what I wanted the new option to do.

I am confident that I could probably get this all to work if I simply opened the original movieClip with a CLICK instead of a MOUSE_OVER, but I'd rather keep using a MOUSE_OVER if there's a way to do it.

I realize that this is all a bit hard to follow, so to summarize - I want a single movieClip to animate, revealing new movieClips. I want to be able to animate these new movieClips (with MOUSE_OVERs and CLICKs), all while the original movieClip remains "open" in its MOUSE_OVER state/frame.

Krilnon
August 11th, 2009, 08:43 PM
You could add the new MovieClips as children of the original clip.

General Tso
August 12th, 2009, 02:19 AM
I'm still relatively new to Flash and don't really know that much about the whole children thing, but I was under the impression that if I nested movieClip B inside movieClip A (which is exactly what I'm doing), that the former was a child by default. Am I wrong?

Also, someone else suggested using a ROLL_OVER and ROLL_OUT instead of MOUSE_OVER and MOUSE_OUT because the former includes all children, which is perfect.

...except that now the problem is the ROLL_OUT is detecting too much. i.e. It is detecting a 'screen' that I made (it's a big white rectangle with 60% alpha) within a movieClip. I just need to figure out how to exclude that specific child.

snickelfritz
August 12th, 2009, 03:15 AM
parent_mc is on the stage, and contains child Movieclips button_mc on layer0, and screen_mc (60% alpha) on layer1;
screen_mc completely covers button_mc.


parent_mc.mouseEnabled = false;
parent_mc.screen_mc.mouseEnabled = false;
parent_mc.button_mc.buttonMode = true;

parent_mc.addEventListener(MouseEvent.MOUSE_OVER, mouse_over);
parent_mc.addEventListener(MouseEvent.ROLL_OVER, roll_over);

function mouse_over(e:MouseEvent):void
{
trace("MOUSE_OVER target: " + e.target.name);
trace("MOUSE_OVER currentTarget: " + e.currentTarget.name);
trace("-------------------------------------");
}

function roll_over(e:MouseEvent):void
{
trace("ROLL_OVER target: " + e.target.name);
trace("ROLL_OVER currentTarget: " + e.currentTarget.name);
trace("-------------------------------------");
}