Copy link to clipboard
Copied
Hello I am trying to modify the color effect of a movieclip my problem is the only way animate does this from what I can see is through the advanced settings of color effects in the editor
Image here.
Is there any way to access these features in as3.
Essentially I just want to make a color picker that can modify the movieclip's advanced color effects.
If anyone has an example of that, it would be very helpful.
Then you did it wrong. That API is how you tint things.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I tried this but it turns the whole clip a solid color. Whereas the advanced color settings just change the hue of the movieclip.
Copy link to clipboard
Copied
Then you did it wrong. That API is how you tint things.
Copy link to clipboard
Copied
I ended up making an overlay clip to cast the color on the object. I couldnt figure out how to do it otherwise.
Copy link to clipboard
Copied
// clip to tint, color (0 - 0xFFFFFF), saturation (0 - 1)
function tintClip(clip, color, sat) {
var ct:ColorTransform = clip.transform.colorTransform;
var r:int = color >> 16;
var g:int = color >> 8 & 0xFF;
var b:int = color & 0xFF;
clip.transform.colorTransform = new ColorTransform(
1 - sat,
1 - sat,
1 - sat,
ct.alphaMultiplier,
r * sat,
g * sat,
b * sat,
ct.alphaOffset);
}
Or more compact:
function tintClip(clip, color, sat) {
var ct:ColorTransform = clip.transform.colorTransform;
clip.transform.colorTransform = new ColorTransform(1 - sat, 1 - sat, 1 - sat, ct.alphaMultiplier, (color >> 16) * sat, (color >> 8 & 0xFF) * sat, (color & 0xFF) * sat, ct.alphaOffset);
}
Copy link to clipboard
Copied
Thank you soo much!
Copy link to clipboard
Copied
I'm still having a little trouble with your code. I messed around with the saturation. and tried to get the image to change color from greyscale.
Essentially I just want to change the images base colors so that instead of say grey and dark grey. it would have red and dark red.
I tried to set the saturation to 1 and -1 but it just either inverts colors or brightens them.
Can you tell me how to call the function to get the desired result.
Essentially I want to be able to modify this.
To something like this.