In this tutorial we will learn how to dynamically animate the color of a movieclip as it called Applying a tint to the movie clip, although with flash 8 we can use the ColorTransform Class which can make what we intend to do but those classes are developed from a while so I created this tutorial based on this files.

We will create 2 class:

1. BindColor Class which will provide 3 useful functions

a. BindColorTo Static function that bind a color to a movie clip instance

b. colorToRGB Static function that retrieve an RGBColor Object from a color number

c. getRGBFrom Static function that retrieve an RGBColor Object from a movieclip

2. RGBColor a Class which can be attached to a movieclip instance

a. attachTo attach the RGBObject to a movieclip.

b. bindTo this function bind the color of the RGBObject to a movieclip instance.

c. red proprety that indicate the red value of the RGBColor object

d. blue proprety that indicate the blue value of the RGBColor object

e. green proprety that indicate the green value of the RGBColor object

f. color proprety that indicate the color value of the RGBColor object

so for if we need to change a color of a movie clip we create an RGBColor object and bind it to the target movie clip.
But if we want to animate the color from on to another we create an empty RGBColor object, attach it to the movie clip instance and then we tween the red, green, blue properties of the RGBColor and we will achieve what we want.

Result



Let’s start with the RGBColor class on the next page