Adding mouse events to dynamically loaded SWF
Posted
by Josamoto
on Stack Overflow
See other posts from Stack Overflow
or by Josamoto
Published on 2010-04-13T17:25:21Z
Indexed on
2010/04/13
17:43 UTC
Read the original article
Hit count: 199
actionscript-3
I am loading an external SWF using the Loader class, and adding it to the stage with addChild.
When trying to add a mouse click event listener to the MovieClip, using addEventListener, nothing happens, the event never fires.
Is there a specific way to add listeners to externally loaded movie clips?
My code looks somewhat like this:
var target:MovieClip = assets["screensaver"] as MovieClip;
target.root.addEventListener(MouseEvent.CLICK, onClickScreenSaver, true);
addChild(target);
The target shows up on the display, but the CLICK event is completely ignored.
© Stack Overflow or respective owner