Oooh. I had to do the trick of filling in the bounds with transparent

pixels so that I'd receive mouse clicks. While contemplating how bitchy
to be in my check-in comment, I wondered why I hadn't needed this when
the video was hosted inside a MediaContainer. It occurred to me that perhaps
the mask was helping, and sure enough: a sprite's mask helps define the
bounds of the sprite for mouse event purposes.

That's really good to know. I'll have to experiment further.

So: set up a mask on the VideoDisplayer, for no other reason than to
be informed of mouse events in all cases.


git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@175 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Ray Greenwell
2007-03-20 21:21:24 +00:00
parent 920a9df3ac
commit 68be6fbe7d
@@ -21,6 +21,7 @@
package com.threerings.flash {
import flash.display.Shape;
import flash.display.Sprite;
import flash.events.AsyncErrorEvent;
@@ -58,6 +59,10 @@ public class VideoDisplayer extends Sprite
_vid = new Video();
addChild(_vid);
_mask = new Shape();
this.mask = _mask;
addChild(_mask);
addEventListener(MouseEvent.ROLL_OVER, handleRollOver);
addEventListener(MouseEvent.ROLL_OUT, handleRollOut);
@@ -133,6 +138,16 @@ public class VideoDisplayer extends Sprite
// set up the width/height
_vid.width = _vid.videoWidth;
_vid.height = _vid.videoHeight;
// set up our mask to be the size of the video so that we're
// guaranteed to get the mouse clicks
with (_mask.graphics) {
clear();
beginFill(0xFFFFFF);
drawRect(0, 0, _vid.videoWidth, _vid.videoHeight);
endFill();
}
redrawPauser();
// tell any interested parties
@@ -275,6 +290,9 @@ public class VideoDisplayer extends Sprite
protected var _vid :Video;
/** Our mask, also defines our boundaries for clicking. */
protected var _mask :Shape;
protected var _paused :Boolean = false;
protected var _netCon :NetConnection;