Skip to main content
Known Participant
February 12, 2017
Question

HTML5 project - top MovieClip not covering mouse interaction underneath it

  • February 12, 2017
  • 1 reply
  • 521 views

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

This topic has been closed for replies.

1 reply

Colin Holgate
Inspiring
February 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.

Saariko2Author
Known Participant
February 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

Colin Holgate
Inspiring
February 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);