Control of flash color deflection technique

Source: Internet
Author: User
Skills | control

Please see a flash color demo:




In the production of flash, we often need to control the color to make our animated films more colorful. So how many ways can you control colors in Flash? There are two answers:

① directly to assign value or retrieve the value of the object, the value is standard RGB format;

Setrgb (r,g,b);//r,g,b is less than 255, an integer greater than 0

getRGB (R,G,B);

② the color value of the object to be deflected, or to retrieve the color values of the objects that have been deflected.

SetTransform (Change_color);

GetTransform (Change_color);

However, when we assign a value to a color object, we do not always need to change the three values of RGB at the same time, but we want one of the values to change, and hope it can "remember" its original color before the change. So, we need to take a good look at how Flash has a color object for color deflection.

Flash provides color deflection such a function of color object operation, so that our work becomes much easier.

You can follow this example step-by-step to learn more about Flash color deflection methods:

One: Create a Color object

Open a new file in the Falsh, like it yourself, draw a shape filled with pure black. Then convert it to a MC object, I drew a square in the example, and named this MC as "Sq".

Someone asked: Why do you want to fill in the black it? The reason is this: RGB is optical color, in RGB three values of 0 o'clock, is no light, that is, dark piece. :) So, we create an "RGB colorless" object, in the future assignment will be able to get all the RGB range of changes in value. Detailed principles, which will be discussed gradually later.

The color change adjustment of the Operation panel

We know: In Flash, you can make a variety of color adjustments to Symbol by Effect floating board.

To open the advanced item, you can see 4 pairs of color adjustments: R,g, B, and Alpha values. By default, the left will be 100%, and the right will be 0.

OK, try typing some values into the Value box on the right, and you should be able to see that the MC has changed color. In fact, you know, this change is not changed the color of the MC, but the color of the MC RGB three channel deflection. (Once you select None in your project, you can return the color of the MC to its original state.)

You may be thinking again: this is the screen operator panel operation, which is manual. In the Flash movie, can I have the parameter free control as I adjust now? The answer is: no problem!

Then, do not move, the MC back to black, we come to the next step!

Three: Code implementation

Look at the code below, is it simple? :)

You can post the following code in the first frame and test the effect

Specify a new Color object to MC
Colora = new Color (_root. SQ);

Define a new color conversion body
Change_color = new Object ();

You have to create a color object first
Then you can assign the new color conversion value to this object

The following is the color deflection value setting

CHANGE_COLOR.RB = 255; Set R deflection
CHANGE_COLOR.GB = 128; Set G deflection
CHANGE_COLOR.BB = 66; Set B Deflection

Implementation of color deflection
Colora.settransform (Change_color);


Another color deflection is written as follows:

The following is the color deflection value setting
Change_color = {ra: ' m ', RB: ' 255 ', GA: ' MB ', GB: ' 128 ',
BA: ', BB: ' $ ', aa: ', AB: ' 0 '};

Implementation of color deflection
Colora.settransform (Change_color);

I personally like the above one to write, although the meaning of the same, but the first one can control a single value (at least three sentences can only write a sentence), the use of more convenient, the second type of writing is not to you.

The area that the code chooses in the figure is the color deflection parameter corresponding to the value on the right side of the effect panel.

They are RB, GB, BB, respectively. Note that they are values that are subordinate to the color conversion body, so use a point connection.

Here is the actual output of the SWF effect and the control Panel inside the effect palette contrast, the result is more clear.

This is the point here, more color control adjustment techniques will be based on the response to continue. :)

Note: For all related Action Script, please refer to the Color keyword in the Falsh help.

Source: The Empire of the shining guest         



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.