views:

28

answers:

1

Does anybody knows if there is a simple way to change this

var colorTransform:NewColorTransform;
colorTransform = new NewColorTransform();
colorTransform.color = Config.ARRAY_COLOURS[1];
color.transform.colorTransform = colorTransform;

That is changing colors (the ARRAY_COLOURS have [ 0xFF0000, 0x0000FF, 0xFFFF00 ])

I would like to have instead of that something like ARRAY_COLOURS[ IMAGE1, IMAGE2, IMAGE3 ]

A: 

We would need more info in order to give you a more accurate answer.

In any case, you probably could do something like this

private var bitmaps:Array = [image1 , image2 , image3];
private var colours:Array = [colour1 , colour2 , colour3];
private var textureTransform:String;
private var selectedBitmap:Bitmap;

private function init():void
{
  switch ( textureTransform )
  {
    case 'bitmap':
      selectedBitmap = bitmaps[1];
      bitmapChange();
      break;

    case 'colour':
      //the example in your question
      colourTransform();
      break;
  }
}

private function bitmapChange():void
{
    this.addChild( selectedBitmap );
}
PatrickS