# copyPixels while moving bitmap when overlay layer has bitmap effects bug?

**URL:** https://forum.kirupa.com/t/copypixels-while-moving-bitmap-when-overlay-layer-has-bitmap-effects-bug/270754
**Category:** flash
**Created:** [September 13, 2008, 4:19pm UTC](https://forum.kirupa.com/t/copypixels-while-moving-bitmap-when-overlay-layer-has-bitmap-effects-bug/270754 "2008-09-13T16:19:38Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ez74](https://avatars.discourse-cdn.com/v4/letter/e/a6a055/32.png) [@ez74](https://forum.kirupa.com/u/ez74)
#### Post date: [September 13, 2008, 4:19pm UTC](https://forum.kirupa.com/t/copypixels-while-moving-bitmap-when-overlay-layer-has-bitmap-effects-bug/270754/1 "2008-09-13T16:19:38Z")

</div>

hi,

Wanted to create a walking character, using a large image of all this character postures as resource.

Did this:

1. Created a new Bitmap with its BitmapData
2. Created an EnterFrame event listener to this Bitmap where:  
a. I move the Bitmap to the right  
b. I change the character posture by copying pixels from the large image to the characters BitmapData

Works fine…

But then I’ve added another layer (sprite) on top of this bitmap.  
Added a glow filter to this layer (sprite) and got the following bug:  
The character (Bitmap) is leaving trails as it moves… as if Flash doesn’t clean after it…

Please see attached files - it’s all there, short and clear.

## Basically, the pseudo code looks like this:

var \_\_sourceBmpData:SourceBmpData = new SourceBmpData(72, 128); // SourceBmpData is a linkage name to an image on the library  
var \_\_imgBmpData:BitmapData = new BitmapData(24, 32, true, 0x00000000);

var \_\_imgBmp:Bitmap = new Bitmap(\_\_imgBmpData);  
this.addChild(\_\_imgBmp);

// add event listener  
\_\_imgBmp.addEventListener(Event.ENTER\_FRAME, Walk);

// bug layer  
var bug\_mc:Sprite = new Sprite();  
this.addChild(bug\_mc);

var glow:GlowFilter = new GlowFilter();  
glow.color = 0xFF0000;  
bug\_mc.filters = [glow];

// enter frame  
private function Walk(event:Event):void {  
\_\_imgBmp.x = 32 + \_\_posX \* 12;  
\_\_imgBmpData.copyPixels(\_\_sourceBmpData, new Rectangle((\_\_posX % 3) \* 24, 32, 24, 32), new Point(0, 0));

\_\_posX++;  
}

* * *

Is it a bug or am I doing somthing wrong?

Thanks,  
EZ
