Fast photo color change

1.6.2009, 19:10
Submited in: Flash | Total Views: 12238

In this thoroughly explained, detailed flash lesson, I will explain to you how to change photo color using the Action Script code, some special flash tips and tricks and Tint filter. You can use this animation for some flash banner or some presentation. Using this lesson, you will also learn how to import any image into a flash stage, how to convert it into a Movie Clip Symbol, how to apply action script code on it and much much more! Let's start!


Step 1

First, find any image which you like to use for this lesson.

Step 2

Press Ctrl+J key on the keyboard (Document Properties) and set the dimensions of your doucment as the dimensions of image. Select any color as background color. Set your Flash movie's frame rate to 92 and click ok.

Step 3

Call the current layer photo. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!

Step 4

Choose now File > Import > Import to stage (Ctrl+R) and import any photo into a flash stage. While the photo is still selected, go to the Align Panel (Ctrl+K) and do the following:

1. Make sure that the Align/Distribute to Stage button is turned on,
2. Click on the Align horizontal center button and
3. Click the Align vertical center button.

Step 5

While the photo is still selected, hit F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol.

Step 6

Select now the Selection Tool (V) and click once on the photo to select it. After that, go to the AS panel (F9) and enter this code inside the actions panel:

 import flash.geom.ColorTransform;
 import flash.geom.Transform;
 redamount = 0;
 goingred = true;
onClipEvent(enterFrame) {
 if (goingred) {
 } else {
 if (redamount == 0 || redamount == 88) {
  goingred = !goingred;
 var colorTrans:ColorTransform = new ColorTransform();
 colorTrans.redOffset = redamount;
 colorTrans.greenOffset = 88-redamount;
 var trans:Transform = new Transform(this);
 trans.colorTransform = colorTrans;

We're done now!

Test your Movie (Ctrl+Enter) and enjoy!

Have a nice day!

Download example

Are you a website owner?
Click here to register and submit your tutorials!

Browse by category

Most popular tutorials