Slice Images With A Matrix

26 April 2009

For my current project I needed something to slice an image easily, first I tried to slice the image with a mask, but I soon found out that this much heavier than my current solution.


Below is the end result I needed to have (the triangle is a big mask).

// image = a MovieClip with an image
// upper part
var upperBitmapData:BitmapData = new BitmapData(image.width,image.height / 2);
mUpperBitmap = new Bitmap(upperBitmapData);
var lowerMatrix:Matrix = new Matrix();
lowerMatrix.ty = -(image.height / 2); 
var lowerBitmapData:BitmapData = new BitmapData(image.width,image.height / 2);
mLowerBitmap = new Bitmap(lowerBitmapData);
mLowerBitmap.y = ContentClip.MASK_HEIGHT / 2;
image = null;
Jankees van Woezik profile picture

Hello, I'm Jankees van Woezik

Like this post? Follow me at @jankeesvw on Twitter