A Flash Developer Resource Site














Internet Commerce

Partners & Affiliates














Developer Channel

internet.com


Featured Flash FLA
Gallery Downloads 11303 Flash Movies | 7 New Flash Movies Added
What's New | Top 100

Featured FLA

» Author: VICENTE VERGARA SILVA
» Title: JORGE ASBUN BOJALIL WEBSITE INTRO
» Description: THIS IS BRIEF A 3D INTRO MADE IN 3D MAX STUDIO FOR A PERSONAL POET WEBSITE. ENJOY.
» More by VICENTE VERGARA SILVA


Random FLAs | Add Flash Movie
Featured Flash Site
Gallery Downloads 6010 Flash Sites | 0 New Flash Links
What's New | Top 100 Flash Site

Featured Site

» Posted in the Flash Kit Links section
» Title: 3D Jobs
» Description: Free job forum for jobs in Films, Video Games, Multimedia and jobs in flash animation and scripting.


Random Links | Add your own Flash Related Links
Flash Tutorials 1255 Tutorials 7 New Tutorials Added!
What's New | Top100

» Make flash video player for broadcasting live streaming video / TV on website
» How to convert the project file of Flash Demo Builder 2.0 into FLV file
» FLV to PSP for Mac - How to convert YouTube video to PSP on mac
» How to Convert FLV to MP4 for Playback on iPod
» how to download and convert youtube video to AVI with Leawo Free FLV converter
» Flash Multi-player Game Tutorial - TicTacToe
» How to make Flash elearning tutorials with screen recorder?
» Fader API:Slideshow with MovieClips on stage
» How to convert MS PPT file into an FLV File
» Unknown Tag: Title10
Random Tutorial | Add Site

Network Design Manager
The Computer Merchant, Ltd
US-VA-Hampton

Justtechjobs.com Post A Job | Post A Resume


Tutorials Home What's New Top Rated Submit myTutes Random!

Search Tutorials


Tutorials Tutorials » Actionscripting

Categories Custom color
Author: Vlad Craita | Website: http://www.siteok.home.ro |

 
Page 1
1

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),
0x663333(brown),0x00FF00(green).
That's all. You've finished. The final script shoul look like this:
for the frame:        function customcolor(thecolor) {
                                 something=new Color(background);
                                 something.setRGB(thecolor);
                             }


for the buttons:   on (release) {
                           customcolor(0x000000);
                          }

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 .


1

» Level Intermediate

Added: : 2003-10-07
Rating: 8.65 Votes: 49
Hits: 1179
» Author
Website designer from Romania who likes to play with Flash, JavaScript and Dreamwever.
» Download
Download the files used in this tutorial.
Download (7 kb)
Get conversion and unzipping tools for PC and Mac here!

» Forums
More help? Search our boards for quick answers!

Please rate this tutorial, 10 is the top rating, you can also click the comments link to read/write a review.
10 9 8 7 6 5 4 3 2 1
Read or Post Comments