Actionscript 3.0 click on hidden object
-
26-10-2019 - |
Question
I have a hidden DisplayObject (myObj.visible = false;
). I've provided a listener:
myObj.addEventListener(MouseEvent.CLICK, myHandler);
By myHandler does never fires. It seems that MouseEvent.CLICK
is not delivered for hidden objects...
How can I listen to MouseEvent.CLICK
for my hidden object?
Solution
Try to put it with alpha=0.
var myDisplayObject = DisplayObject(myObj);
myDisplayObject.alpha = 0
myDisplayObject.addEventListener(MouseEvent.CLICK, handler);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow