hi,
Wanted to create a walking character, using a large image of all this character postures as resource.
Did this:
- Created a new Bitmap with its BitmapData
- 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