Wire up for hit-testing just like object tiles.

git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@986 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
Mike Thomas
2010-08-17 17:06:54 +00:00
parent 815b5d7be7
commit 8f337e26d9
2 changed files with 23 additions and 7 deletions
@@ -22,6 +22,8 @@ package com.threerings.cast {
import flash.display.Bitmap;
import flash.display.Sprite;
import flash.geom.Point;
import flash.events.Event;
import com.threerings.media.Tickable;
@@ -73,6 +75,22 @@ public class MultiFrameBitmap extends Sprite
return _frames.length;
}
public function hitTest (stageX :int, stageY :int) :Boolean
{
if (_curFrameIndex == -1) {
return false;
} else {
var frame :Bitmap = getFrame(_curFrameIndex);
if (frame.hitTestPoint(stageX, stageY, true)) {
// Doesn't even hit the bounds...
return false;
}
// Check the actual pixels...
var pt :Point = frame.globalToLocal(new Point(stageX, stageY));
return frame.bitmapData.hitTest(new Point(0, 0), 0, pt);
}
}
protected var _frames :Array;
protected var _bitmap :Bitmap;