A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: How to update a bitmapData based on changes to the parent bitmap?

  1. #1

    How to update a bitmapData based on changes to the parent bitmap?

    I have a set of sprites in my game that all face to the right (there are lots of frames of animation, several hundred in total).

    I want the sprite to be able to face both directions, so rather than mirror and duplicate all of the PNGs (sprite frames) I am doing it via code.

    If I create a bitmap and then scaleX = -1 it reverses itself perfectly.

    However, if you then access the bitmapData of that bitmap, the data remains exactly the same (facing the opposite direction), and isn't updated when you perform operations on it (such as scaleX).

    Does anyone know a way to get around this?! I want to create a bitmap, flip it and have that bitmaps data reflect this change.



  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    press the picture...
    Try using the draw function to create a new bitmap from the reversed bitmap.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Join Date
    May 2007
    If performance is a concern, you can manually flip the columns using set/getPixels

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center