Hello all,
this technically probably isn’t a Flex question, but I’m using FlashDevelop, and thus the [Embed] tag, which isn’t used by CS4.
I’ve got a Tile object, that can have 4 different colours. I’ve got 4 .png images that each represent one of the colours. What’s the best way to go about this? Does it make any difference if I make 4 seperate classes that each reflect a Bitmap with the colour, or just Embed all 4 images in the Tile object, and then decide which to display?
This is how I’ve got it set up currently:
In tile.as:
switch(this.type)
{
case "Red":
graphic = new RedTile;
break;
etc.
And this is how my RedTile class looks:
package game
{
import flash.display.Bitmap;
public class RedTile extends Bitmap
{
[Embed(source = '../../lib/red.png')]
private var Graphic:Class;
public function RedTile()
{
var pic:Bitmap = new Graphic();
this.bitmapData = pic.bitmapData;
pic = null;
}
}
}
Is this a good way of doing it, or would you recommend I take a different path? Thanks in advance.