Replacing a colour/colours in a movieclip with different colours?

Posted by Oli on Stack Overflow See other posts from Stack Overflow or by Oli
Published on 2010-02-08T21:22:41Z Indexed on 2010/03/26 1:03 UTC
Read the original article Hit count: 268

Filed under:
|
|
|

I am trying to take a movieclip of a character and change the colour of their clothes. The character is comprised of vectors.

So far I have semi-sucessfully used this method:

  1. stop the movieclip
  2. take the bitmap data from the current frame
  3. use threshold to replace the colour
  4. store the resulting bitmap data in an array
  5. add an onenterframe function - clear the current frame and add the bitmap data from the processed data in the array

So - this works pretty well. Each frame is only processed once at the beginning and then the write to the movieclip is very quick.

However! As the replacement is being performed on a bitmap there is an amount of aliasing that takes place to remove jaggies/pixelation. This produces colours that are not matched using threshold. So the main colour is replaced correctly but it is surrounded by a halo of mixed colours :(

I am sure there should be a better way to do this. Any ideas or answers would be greatly apreciated - Thanks.

© Stack Overflow or respective owner

Related posts about as3

Related posts about colours