Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
thank you Colin for your (ALWAYS!) quick responses..
actually no, alpha is 1.
check this simple test:
Copy link to clipboard
Copied
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);
Copy link to clipboard
Copied
Yep that's what I wrote.
In Flash this function is not needed.
Thnx
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now