addEventListener question


#1

If I add:

this.video.addEventListener (MouseEvent.MOUSE_DOWN, this.mousedown);

to the PlayingVideo sample it doesn’t seem to register. Can I add event listeners to video playing ? Or it isn’t supposed to work so the current execution is correct ?


#2

Video (like the more commonly used Bitmap used) is not interactive (it does not extend InteractiveObject) so it does not dispatch mouse events. However, it will trigger hit testing if you put it in in a Sprite.

Try this.addEventListener to listen to the whole application, or try putting the video in a Sprite container, like this:

var container = new Sprite ();
container.addChild (this.video);
this.addChild (container);
container.addEventListener (MouseEvent.MOUSE_DOWN, this.mouseDown);

#3

That fixes it.
Can’t find the icon that states the post fixes the problem, but it does anyways.
Thanks singmajesty.