Canvas
Canvas

Reputation: 5897

How to Change Hue and Saturation of a MovieClip in AS3

I have myself a movieclip that has multiple images in, I want to be able to use AS3 to change the Hue and Saturation so the client can choose a colour and it will change the colour of the movieclip to their settings.

I have tried this

var my_color:ColorTransform = new ColorTransform();
my_color.color = 0x550000;
tempPlayer.transform.colorTransform = my_color;

But the movieclip just becomes completely red, I just want to be able to add a touch of colour, and then make the colour stand out a bit using AS3. Basically something like this enter image description here but from grey to one colour

Canvas

Upvotes: 1

Views: 4406

Answers (1)

Marty
Marty

Reputation: 39466

For saturation it gets a little more complicated than the traditional ColorTransform. Often, you will need to use ColorMatrixFilter.

This feature is quite complicated, but this blog post describes the process quite well and gives you code for a couple common effects.

That said, you can add just a little color to an object with ColorTransform by using the *Offset and *Multiplier properties like greenOffset and redMultiplier. This lets you offset the red, green or blue values a little to give different effects.

Upvotes: 2

Related Questions