Ok, here’s the deal:
I have a class called StripeMask.
It has a function called open. Basically takes in 2 parameters:
- Movieclip where to make a bitmapdata mc
- movieclip from what the snapshot for bitmapdata is made
So what it does is make many movieclips, each containing a piece of that bitmap. Stripes as i say (width=target._width and height=stripeHeight).
For every stripe i need to make a BitmapData.draw from that movieclip and add a Rectangle to it so it would be in correct size. Problem is thou that the other area of that bitmap is filled with alpha pixels and when i tween those pieces (stripes) it comes very laggy. One workaround I found is that I add a simple mask to those pieces. It was a great improvment but it still takes quite a lot memory.
I’ll paste my code here:
public function close(open_mc:MovieClip, where_mc:MovieClip):Void
{
nStripeH = 50;
aClips = new Array();
var nT : Number = nH / nStripeH;
var myMatrix : Matrix = new Matrix ();
var myColorTransform : ColorTransform = new ColorTransform (1, 1, 1, 1, 0, 0, 0, 0);
var blendMode : String = "normal";
var mainBitmap : BitmapData = new BitmapData (nW, nH, true, 0x00FFFFFF);
for (var i : Number = 0; i < nT; i ++)
{
var myBitmap : BitmapData = mainBitmap.clone ();
var myRectangle : Rectangle = new Rectangle (0, nStripeH * i, nW, nStripeH);
myBitmap.draw (open_mc, myMatrix, myColorTransform, blendMode, myRectangle);
var mcClip : MovieClip = where_mc.createEmptyMovieClip ("mcClip_" + i, where_mc.getNextHighestDepth ());
var mcImg:MovieClip = mcClip.createEmptyMovieClip("mcImg",mcClip.getNextHighestDepth());
var mcMask:MovieClip = Geom.createRectangle(mcClip,"mcMask",nW,nStripeH,0xFF0000);
mcImg.setMask(mcMask);
mcMask._y = (i * nStripeH);
mcImg.attachBitmap (myBitmap, 0);
mcClip.tween (["_alpha", "_visible","_y"] , [0, 0,(nT-i)*4*-1] , 1, "easeInElastic", i * 0.08);
aClips.push([mcClip,myBitmap]);
}
}
**So my question is: **How could i make these bitmaps in a certain size so that they wouldn’t eat up the memory with their alpha pixels?
I first thought that I could use a Rectangle istance when creating bitmaps, but that’s not possible. Any ideas?