Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Double Rollover/Rollout Conundrum

Guest
Sep 05, 2013 Sep 05, 2013

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.

TOPICS
ActionScript
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 05, 2013 Sep 05, 2013

you can use the stopPropagation() method of your mouse event to stop the event from being propagated to other listeners.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 05, 2013 Sep 05, 2013

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 05, 2013 Sep 05, 2013

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 06, 2013 Sep 06, 2013

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!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Sep 09, 2013 Sep 09, 2013

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Sep 09, 2013 Sep 09, 2013

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?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 09, 2013 Sep 09, 2013

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Sep 09, 2013 Sep 09, 2013
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Sep 05, 2013 Sep 05, 2013

be sure to understand the differnce between target/currentTarget

http://www.wastedpotential.com/flash-as3-target-vs-currenttarget/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines