Flash creates a complex gradient fill effect

Source: Internet
Author: User

Create a new Flash document and save it as a radialgradient.fla.
Add the following ActionScript to frame 1th of the timeline:

The code is as follows Copy Code

This.createemptym Ovieclip ("GRADIENT_MC", 10);
var filltype:string = "Radial";
var colors:array = [0xff0000, 0x0000ff];
var alphas:array = [100, 100];
var ratios:array = [0, 0xFF];
var matrix:object = {a:200, b:0, c:0, d:0, e:200, f:0, g:200, h:200, i:1};
var spreadmethod:string = "Reflect";
var interpolationmethod:string = "Linearrgb";
var focalpointratio:number = 0.9;
with (GRADIENT_MC) {
    Begingradientfill (filltype, colors, alphas, ratios, Matrix, Spreadmethod, Interpolationmethod, Focalpointratio);
    moveTo (100, 100);
    lineTo (100, 300);
    LineTo (300, 300);
    lineTo (300, 100);
    lineTo (100, 100);
    Endfill ();
}

The preceding ActionScript code uses the drawing API to create a square on the stage, and then calls the Begingradientfill () method to populate the square with a red and blue circular gradient.

Save the Flash document and select Control > Test movie to test the Flash file.

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.