0 Replies Latest reply on Mar 21, 2011 6:23 PM by Seglespaan

    colour transform

    Seglespaan Level 1

      Hi,

       

      I'm having a bit of trouble using colour transform on a swf file.

       

      the swf is a clipart graphic made up of black and white elements. I want to transform the black elements to a chosen colour but want to leave the whites in tact.

       

      the following method transforms both the whites and blacks, but it does change both to the correct colour.

       

      private function correct_colour_handler(e:Event):void

      {

      var colour = '0x04129c';

       

      var r:Number = colour >> 16;

      var g:Number = (colour ^ colour >> 16 << 16) >> 8;

      var b:Number = colour >> 8 << 8 ^ colour;

       

      transform_this.transform.colorTransform = new ColorTransform(0,0,0,1,r,g,b,1);

       

      }

       

       

       

      however this method only changes the blacks but the resulting colour is slightly lighter than desired. Is there a way to transform only the black elements of a swf and get the correct colour?

       

       

      private function wrong_colour_handler(e:Event):void

      {

      var colour = '0x04129c';

       

      var r:Number = colour >> 16;

      var g:Number = (colour ^ colour >> 16 << 16) >> 8;

      var b:Number = colour >> 8 << 8 ^ colour;

       

      transform_this.transform.colorTransform = new ColorTransform(1,1,1,1,r,g,b,1);

      }

       

      cheers

       

      tim