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

HTML5 project - top MovieClip not covering mouse interaction underneath it

Explorer ,
Feb 12, 2017 Feb 12, 2017

hey all

In Flash days - we sometimes use to block a MovieClip's mouse interaction by covering it with another MovieClip above it.

In HTML5/Canvas - this doesn't work and the MovieClip below still fires mouse interactions, unless we either:

1) register a listener for mouse interaction for the top (covering) movieclip as well

2) disable the lower MovieClip's interaction (either with mouseEnabled or removing the listener).

Is this expected behaviour? Is this a bug?

Any quick workarounds?

thanx in advance

Sa'ar

456
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
LEGEND ,
Feb 12, 2017 Feb 12, 2017

I imagine you have an alpha 0 object on top. Under CreateJS that doesn't trigger mouse events. Try setting it to have an alpha of 1 (using the Properties panel).

Alternately, use a button, whose idle and over states are empty, and its hit state covers the area you want to block.

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
Explorer ,
Feb 12, 2017 Feb 12, 2017

thank you Colin for your (ALWAYS!) quick responses..

actually no, alpha is 1.

check this simple test:

http://s000.tinyupload.com/?file_id=03271364644378113888

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
LEGEND ,
Feb 12, 2017 Feb 12, 2017

Your example doesn't have a function for mc2. The hit areas will only be set up for objects that have code. Try adding this:

this.nothing = function(evt) {

}

this.mc2.on("click", this.nothing, this);

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
Explorer ,
Feb 12, 2017 Feb 12, 2017

Yep that's what I wrote.

In Flash this function is not needed.

Thnx

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
LEGEND ,
Feb 13, 2017 Feb 13, 2017
LATEST

The behavior you were expecting is specific to Flash/Animate AS3 documents. In Flash AS2 documents the behavior has always been identical to how Canvas does it-- objects only intercept mouse events if they themselves have a mouse listener.

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