Posts Tagged mouseEnabled
Before ActionScript 3 came, when you had a MovieClip over a button, if that MovieClip didn’t have any mouse function (onRelease, onRollOver, etc) you could interact with the button underneath. Most of the time this was an unwanted behavior that you had to circumvent by putting an invisible button in your MovieClip and use the useHandCursor = false line of code.
Well in Flash 9, it doesn’t work that way anymore, if you have a displayObject in front of a button (or displayObject with mouseEvent listeners), it will block the mouse events from happening. That’s really nice in most cases, you don’t have to do the invisible button anymore. But in the project that I just released I had these PNGs with a lot of transparency, so you could see the button underneath. The thing is that you couldn’t interact with the button because of what I just explained earlier. I looked the documentation a bit and I found this property of the DisplayObject: mouseEnabled which is useful in these situations. When you set mouseEnabled to false, your MovieClip, Sprite, DisplayObject will be transparent to mouse events like clicks, rollOvers etc. That way button that are under the DisplayObject with mouseEnabled=false can still work.
Another neat thing with that is that DisplayObject inside the DisplayObject with mouseEnabled=false can still have mouse events. So it’s pretty customizable and useful.