# Slight problem with BitmapData

**URL:** <https://forum.kirupa.com/t/slight-problem-with-bitmapdata/176321>\
**Category:** flash\
**Created:** [January 22, 2006, 10:08pm UTC](https://forum.kirupa.com/t/slight-problem-with-bitmapdata/176321 "2006-01-22T22:08:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![v2ikematu](https://avatars.discourse-cdn.com/v4/letter/v/3d9bf3/32.png) [@v2ikematu](https://forum.kirupa.com/u/v2ikematu)\
**Post date:** [January 22, 2006, 10:08pm UTC](https://forum.kirupa.com/t/slight-problem-with-bitmapdata/176321/1 "2006-01-22T22:08:14Z")

</div>

Ok, here’s the deal:  
I have a class called StripeMask.  
It has a function called open. Basically takes in 2 parameters:

1. Movieclip where to make a bitmapdata mc
2. 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:

```auto

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?
