# bitmapData question

**URL:** https://forum.kirupa.com/t/bitmapdata-question/190423
**Category:** flash
**Created:** [June 11, 2006, 6:09pm UTC](https://forum.kirupa.com/t/bitmapdata-question/190423 "2006-06-11T18:09:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![louissi](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/louissi/32/2189_2.png) [@louissi](https://forum.kirupa.com/u/louissi)
#### Post date: [June 11, 2006, 6:09pm UTC](https://forum.kirupa.com/t/bitmapdata-question/190423/1 "2006-06-11T18:09:46Z")

</div>

i am making a brick game in flash, and i want to destroy my bricks in a special way. Here is the function i created:

> import flash.display.BitmapData;  
> function destroy() {  
> for (xv=30; xv\>0; xv–) {  
> for (yv=15; yv\>0; yv–) {  
> id = \_root.getNextHighestDepth();  
> \_root[“bmp\_data”+id] = new BitmapData(1, 1, false, 0x000000);  
> \_root.createEmptyMovieClip(“bmp\_mc”+id, \_root.getNextHighestDepth());  
> \_root[“bmp\_mc”+id].\_x = xv+this.\_x;  
> \_root[“bmp\_mc”+id].\_y = yv+this.\_y;  
> \_root[“bmp\_data”+id].draw(this);  
> \_root[“bmp\_mc”+id].attachBitmap(\_root[“bmp\_data”+id], 1);  
> \_root[“bmp\_mc”+id].onEnterFrame = function() {  
> !this.ys ? this.ys=Math.random() : null;  
> !this.timer ? this.timer=Math.random()\*20 : this.timer++;  
> this.\_y -= this.ys;  
> trace(this.ys);  
> this.\_alpha -= 4;  
> if (this.\_alpha\<0) {  
> this.removeMovieClip();  
> trace(“removed”);  
> }  
> this.\_x += Math.sin(this.timer/10);  
> this.timer++;  
> };  
> }  
> }  
> this.\_visible = false;  
> }

this code is contained in a mc that contains a 30x15 brick image. It works well, but the bitmapdata seems to be drawing the top left corner of it. I want every bitmap objects to draw a part of the brick, not the top left pixel. Anyone could help me?
