var bmd:BitmapData = new BitmapData(gridBox.width, gridBox.height); var bitmap_Data:BitmapData; var bitmap:Bitmap = new Bitmap(); bmd.draw(gridBox); //gridBox is a class which extends MovieClip private function setSize():void { var wcount:int = width1; var hcount:int = height1; var rect:Rectangle = new Rectangle(0, 0, 25, 25); bitmap_Data.dispose(); bitmap_Data = new BitmapData(width1 * BOXSIZE, height1 * BOXSIZE); bmd.lock(); bitmap_Data.lock(); for (hcount; hcount > 0; hcount--) { for (wcount; wcount > 0; wcount--) { bitmap_Data.copyPixels(bmd, rect, new Point((width1 - wcount) * BOXSIZE, (height1 - hcount) * BOXSIZE)); } wcount = width1; } bmd.unlock(); bitmap_Data.unlock(); bitmap.bitmapData = bitmap_Data; bitmap.width = width1 * BOXSIZE; bitmap.height = height1 * BOXSIZE; addChild( bitmap ); }