Allow layer click button in Flash / ActionScript3
I have the following layer structure in Flash:
- Spotlight - has a transparent center area, is a bitmap symbol
- Button
How to make it Button
clickable, even if a layer Spotlight
? I want to toggle the visibility of the layer Spotlight
by clicking Button
, like the following code.
Button.addEventListener(MouseEvent.MOUSE_CLICK, OnClick);
function OnClick(e:MouseEvent):void
{
Spotlight.visible = !Spotlight.visible;
}
+2
source to share