I’m trying to use an image as my mask, but drawMask wants BitmapData. I’ve tried getting the Image’s .source but it says .source doesn’t exist.
package {
import net.flashpunk.Entity;
import flash.display.BitmapData;
import net.flashpunk.graphics.Image;
import net.flashpunk.FP;
/**
* ...
* @author Skelyton
*/
public class Bladder extends Entity
{
[Embed(source = '../assets/graphics/bladderEmpty.png')] private const BLADDEREMPTY_GRAPHIC:Class;
[Embed(source = '../assets/graphics/bladderFill.png')] private const BLADDERFILL_GRAPHIC:Class;
[Embed(source = '../assets/graphics/bladderMask.png')] private const BLADDERMASK_GRAPHIC:Class;
protected var bladderEmptyImg:Image;
protected var bladderFillImg:Image;
protected var clippingMask:Image;
//protected var clippingArea:Rectangle;
public function Bladder()
{
bladderEmptyImg = new Image(BLADDEREMPTY_GRAPHIC);
bladderFillImg = new Image(BLADDERFILL_GRAPHIC);
clippingMask = new Image(BLADDERMASK_GRAPHIC);
graphic = bladderEmptyImg;
//clippingMask = new BitmapData(92, 108, false, 0x00ffffff);
this.x = FP.screen.width - 112;
this.y = 20;
bladderEmptyImg.drawMask = clippingMask.source;