4 Replies Latest reply on May 4, 2008 6:59 AM by Xopods

    Displaying part of an image

      I'm making a board game in Flex. Both to save bandwidth and for convenience in the code, I want to store the bitmaps for all the tiles in a single GIF, then just display the appropriate part of that GIF in each tile's Image object.

      Here's a simplified example of what I'm trying to do. Let's say each tile has 2 boolean properties, giving 4 possible tiles, each of which has its own 32x32 bitmap. So, my tiles.gif is going to be 64x64, but each tile Image object is 32x32 and I'm displaying of the four quadrants of the GIF, depending on whether that tiles is (true, false), (true, true), or whatever.

      This is pretty easy to do in Java and I assumed it would be obvious in Flex, but I can't find the appropriate properties in the Image class. First of all, when I set the width and height to 32, it resizes the Image. So first of all, I need to know how to stop the image from resizing, and second of all, I need to know how to change which section of the image is displayed.

      Am I overlooking something obvious, or am I going to have to do something using the Bitmap class and bind that to the Image objects, or what?