Copy link to clipboard
Copied
Hi Everybody,
I have an issue where I have a layer with a movieclip in it that globally covers the whole stage. Everytime the user rolls over it, it triggers a MC reveal. Everytime the user rolls out, it goes back into hiding. It is meant to only rollover/rollout when the user's mouse comes onto or leaves the stage area.
The problem I have is I have other movieclips on layers above it that have rollover/release functions as well. So everytime I rollover one of them it accidentally trigers the global stage rollover/out beneath it.
Is there a way I can have a rollover for a hit area covering the complete stage underneath other functinoing MC buttons without it triggering an early rollout?
Does that makee sense? Is there a solution?
Thanks for any feedback.
Copy link to clipboard
Copied
you can use the stopPropagation() method of your mouse event to stop the event from being propagated to other listeners.
Copy link to clipboard
Copied
I'm not really trying to stop the ones on top, more I'm trying to keep the buttons/movie clips on top of the main button from affecting the rollout command of the one below them.
I want the only rollout for the bottom MC to be the border of the stage not from anything above it that could get in the way?
Know what I mean?
Copy link to clipboard
Copied
any object1 at a depth greater than object2 should intercept mouse events so they're not detected by object2.
is that the problem? a rollover of object1 is triggering a rollout of object2?
Copy link to clipboard
Copied
One's on a layer above the other. I haven't even assigned them depths as children. They're merely on the stage.
However, yes, that's exactly my problem. How can I get around this? I'm happy to assign things a certain way if that's necessary.
Thanks everybody!
Copy link to clipboard
Copied
I haven't even assigned them depths as children. They're merely on the stage.
No two objects inhahbit the same displayindex in a flash file, so the index of a child (where it sits on the disply list) is unique.
If you don`t assign a depth/index to your object flash will do it for you.
Beware: The Layers you use in the timeline are not identical with the index flash uses to soret them on the displaylist.
So while you may have hundreds oof movieclips placed on one and the same layer in the timeline, internally they will all have their own index on the displaylist.
when you use addChild(mc) flash will add the object always on the highest index
yu can specify the index which your object gets assigned with
addChildAt(mc,0) will always place the object benaeth all objects on the stage
addChildAt(mc, stage.numChildren-1) will always place the object above all objects on the stage
Copy link to clipboard
Copied
Okay, that's good to know but one is still on top or below in index, right? Then how do I make the MC on top not affect the rollout of the MC underneath?
Copy link to clipboard
Copied
i think you'll need to encode that yourself. maybe have your rollout call another function with a delay (of say 100ms) and in that function check if there is a rollover triggering the rollout.
Copy link to clipboard
Copied
any moviclips overlaying other movieclips can be made "invisible" to the mouse by setting their mouseEnabled property to false.
So even when they are on a higher Index they will ignore any rollovers or clicks that are passing through them.
Copy link to clipboard
Copied
be sure to understand the differnce between target/currentTarget
http://www.wastedpotential.com/flash-as3-target-vs-currenttarget/
Find more inspiration, events, and resources on the new Adobe Community
Explore Now