First time here? First time here? Newsletter Signup Newsletter
Search tutorials
Author: Vlad Craita | Website: http://www.siteok.home.ro

This tutorial will show you how you can change the color of a movie clip. Three easy steps must be completed.

Step 1:

Draw a rectangle, bigger than the dimensions of you scene. The color doesn't matter.
Now that you've done that make it a symbol, by pressing F8, the type should be Movie Clip.
Click OK. Name this instance 'background'. Make it cover the whole scene.

Step 2:

In another layer make a button by drawing something and pressing F8, then Ok with the Button property selected.
Right click the button and click copy. Then click paste. Do this 5 times. Now align in
an order the buttons, like i did. Click the first button, and from the property panel click the Color
property and select Tint. Then choose a color(don't forget to write down the code of the color, we'll use it later-the code
is that combination of numbers with letters, numbers or just letters, like 00CC00). Do this for each of your buttons. Of course
with another color. It should look like mines, except for the colors, which are your own options.

Step 3:

Now we have two layers. One with the background and another one with the buttons.
Click frame one, no matter the layer, and open the Actions panel.
Because we have more than one button we will use a fuction. A function can be used by more
than one button if the code is identical. This is what a personalized fuction does. There are other types of functions, but they are not good in our case. We don't want the buttons to have an identical code, because if we need to make a change in the code we'll have to select each time a button and modify it's code. It takes a while to do this so with functions it's a lot easier.
The buttons are using a function, and when we want to change the script we'll just have to change the content of the function.
We won't have to involve the buttons in this process. So it will take less time.
I hope you understand the importance of the function in this tutorial, even if i can't explain it better.
Now for the script. Insert a function by double clicking the name 'function'(or click on the place where the code will
be added and then press ESC+fn). In the Name box type the name of the function - i typed 'customcolor'. In the parameters field type 'thecolor' or anything else you want. Insert an 'evaluate' action. Press ESC+ev or just double click its name.
Write 'something=new Color(background)'. 'something' is a variable that will contain the information of a color for the
movie clip named background. Lets give this variable an information about the color that the background will have.
So insert another 'evaluate' action. Type 'something.setRGB(thecolor)'. RGB means Red Green Black. Any color is a combination of those colors, and in () variable that holds the code assigned to a color.

Now we have to make the buttons use this function.
Select the first button. Insert an 'evaluate' action (ESC+ev), and type the name of the function, in my case 'customcolor()'.
In () type the code of the color for that button which you've writen, with 0x in front of it. For my first button i've typed 'customcolor(0x000000)'.
The parameter 'thecolor' from the function will be in this case 0x000000(black).
Do this for all of the buttons, and in () type the code for the colors. I have 0xFF0000(red), 0xFFFF00(yellow),0x0066FF(blue),
That's all. You've finished. The final script shoul look like this:
for the frame:        function customcolor(thecolor) {
                                 something=new Color(background);

for the buttons:   on (release) {

Of course, in the () is a code different for each button.

If you want more colors you'll have to make another button, color it with Tint so you can see what color will be selected
and then type the code for the button - the code will look like the one above, it will have something else in the brackets.

Thank you for your patience in reading my tutorial.

For questions email at vladbz@yahoo.com .

» Level Intermediate

Added: 2003-10-07
Rating: 8.86 Votes: 51
(10 being the highest)
» Author
Website designer from Romania who likes to play with Flash, JavaScript and Dreamwever.
» Download
Download the files used in this tutorial.
» Forums
More help? Search our boards for quick answers!


  • There are no comments yet. Be the first to comment!

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.
Featured Flash FLA
» Author: Inocreato
» Title: RaiseTheBlocks
» Description: Raise all the blocks to win the game
Featured Sound Loops
Image for equalize

Audio Player

» Author: TomCat Carty
» Title: The Wood
» Description: Just a little game ending or it can maybe be looped. Recorders with music box and percussion to give the feel of well, I don't know, the woods? Free to use, just credit me. thank you
Latest Font
» Author: Fábio FAFERS
» Description: I created this font for free use. Everyone can apply it in personal or business texts. Its free, but I want to be communicated in case of business use. Donations are accepted to keep the project of free fonts alive! Thank you all
Featured Sound Fx
Image for equalize

Audio Player

» Author: Davisigner
» Description: Hmm... what to say about this one? It's reminiscent of the closing notes of the opening music from the Three Stooges done in a church organ style with a closing cymbal crash. I'll give this one away gratis, but feel free to check out my free loops and potential upcoming license-mandated ones over in the respective part of Flashkit.