Amen is an industrial informatics engineer. he studied the first four years of his education in Faculty of Engineering in Lebanon. He went to France to Continue his studies by doing the fifth year of engineering and the master TIS (Technologie Information et Système) in the same time at UTC (Université de Technologie de Compiègne). He also work as a freelancer in flash development field. He is always interessted in the new multimedia technologies.
Time: 30 minutes
Difficulty Level: Intermediate
Requirements: Flash 6+
in this tutorial you will learn how to create two classes which will be handy to apply a tint to a moviclip and also lear how to animate a tint over a movieclip.
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
In the RGBColor class you will find four propreties which will interact with the setter of each one a function that is called refreshColor will be called to update the display of the attached mc to the object IF non is attached nothing happens. Lets examine the class:
In this class we will create some useful public static function to handle the color of a movieclip with the RGBColor Class. the class code is below so let's take a look.
Class
[as]
import com.core.RGBColor;