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: 288
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:
- stop the movieclip
- take the bitmap data from the current frame
- use threshold to replace the colour
- store the resulting bitmap data in an array
- 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