vrijdag 11 februari 2011

Buttons and mouse transparency

It's a wellknown fact by now, that using this:
this.mouseEnabled=false;
this.mouseChildren= false;
will prevent an object from receiving mouse-events, BUT.... So you can put buttons underneath something and still get your mouseevents..

I am creating the ludatic site as we speak in AS3 and came across the following.
I create a loader and load an overlayer from a file (for instance a menu).
The menu had a big transparant PNG.
Now the buttons on the page below didn't work anymore. Naturally, I had to
I could set this up differently, but I think you should be able to fix these things programmatically, without rethinking your designs or the way you build them up.
So I set the mouseEnabled and this.mouseChildren property in the document class. It still didn't work..

After a lot of scratching my head and staring at the wall with my head in my hands....

Offcourse: The loader is mouseEnabled, this is a default. The big transparent PNG is not enabled, but it is inside the loader.content, which is a display object and therefore receives (and blocks) mouseEvents.
So the idea is to set the loader to mouseEnabled=false (and it's children) and there you go..

Geen opmerkingen:

Een reactie posten