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


1 answer


While I was looking at something else I found this.



Spotlight.mouseEnabled = false;
Spotlight.mouseChildren = false;

      

+7


source







All Articles