[SWF (backgroundColor = 0x000000, width = 550, height = 400)] // sets the background color and size of the scenario.
Var r: uint = 0, g: uint = 0, B: uint = 0; // declare unsigned integer variables r, g, and B. The initial values are all 0.
Var color: uint, targetR: uint, targetG: uint, targetB: uint; // declare the unsigned integer variables color, targetR, targetG, targetB
Var filtersCo: uint, filtersR: uint, filtersG: uint, filtersB: uint; // declare unsigned integer variables filtersCo, filtersR, filtersG, and filtersB
Var glowF: GlowFilter; // declare a luminous filter instance glowF
Var matrix: Matrix = new Matrix (); // declare a matrix class instance matrix
Matrix. createGradientBox (550,200, 550, 0, 0); // Set The Matrix style required for gradient filling of the vector graph (200 in width, in height, 0 in rotation, 0 in X direction, 0 in Y direction)
Var sh: Shape = new Shape (); // declare a vector graph instance sh
Sh. graphics. beginGradientFill (GradientType. LINEAR, [0xff0000, 0xffff00, 0x00ff00, 0x00ffff, 0x0000ff, 0xff00ff, 0xff0000], [84,126,168,210,255,], [,], matrix ); // Set the gradient fill style (linear gradient, color block color, transparency, color block position, matrix)
Sh. graphics. drawRect (550,200, 550); // draw a rectangle in sh (coordinate in the upper left corner (200), width, height)
Sh. graphics. endFill (); // end filling
Var bone density: BitmapData = new BitmapData (550,200); // declare a bitmap data instance bone density (550 in width and 200 in height)
Var bim: Bitmap = new Bitmap (BMI); // declare a Bitmap package instance bim, used to package BMI
Bone mineral density. draw (sh); // bitmap bone mineral density is taken as a vector image sh.
AddChild (bim); // adds the bitmap bim to the Display List.
Var txt: TextField = new TextField (); // declare a text class instance txt
AddChild (txt); // add the text txt to the display list
Txt. defaultTextFormat = new TextFormat (" 文 ", 60); // set the text format (font, font size). Note that this setting takes effect only when it is placed before the content.
Txt. text = "Welcome to China tutorial network! "; // Text content
Txt. autoSize = TextFieldAutoSize. CENTER; // The text txt is automatically adjusted and aligned in the CENTER.
Txt. x = stage. stageWidth/2-txt.width/2; // the X coordinate of the text. Place the text in the middle of the stage.
Txt. y = stage. stageHeight * 3/4-txt. height/2; // Y coordinate of the text, where the text is placed in the vertical 3/4
AddEventListener (Event. ENTER_FRAME, frame); // add frame rate Event listening and call the function frame
Function frame (e) {// defines the frame rate event function frame
Color = BMI. getPixel (mouseX, mouseY); // color gets the color of the pixel at the bitmap mouse.
TargetR = color> 16; // obtain the value of the red channel in the color.
TargetG = color> 8 & 0xff; // obtain the value of the green channel in the color.
TargetB = color & 0xff; // Obtain the blue channel value in the color.
R + = uint (targetR-r) * 0.03); // The difference between targetR and r is increased by 0.03 times per frame.
G + = uint (targetG-g) * 0.03); // g increases the targetG and g difference by 0.03 times per frame
B + = uint (targetB-B) * 0.03); // each frame of B is increased by 0.03 times the difference between targetB and B.
Txt. textColor = r <16 | g <8 | B; // you can specify the r, g, and B colors to the text txt.
FiltersR = 0xff-r; // filtersR obtains the difference between 0xff and r.
FiltersG = 0xff-g; // filtersG obtains the difference between 0xff and g.
FiltersB = 0xff-b; // filtersB gets the difference between 0xff and B
FiltersCo = filtersR <16 | filtersG <8 | filtersB; // you can specify the colors of filtersR, filtersG, and filtersB to filtersCo.
GlowF = new GlowFilter (filtersCo, 8); // Glow filter glowF instantiation (color, transparency, X direction blur value, Y direction blur value)
Txt. filters = [glowF]; // apply the luminous filter to text.
}
// ================ Description
Var txt1: TextField = new TextField (); // declare a text class instance txt
AddChildAt (txt1, numChildren-1); // add txt to the bottom of the Display List
Txt1.defatexttextformat = new TextFormat (" 文 ", 20, 0x00cc33); // set the text format for txt (文, 30, dark green)
Txt1.text = "Full script text color easing effect move the mouse to move the colorful graph to change the text color"; // text txt content
Txt1.x = 20; // Obtain the X coordinate of the text txt file by 20
Txt1.y = 360; // Obtain the Y coordinate of the text txt file by 360
Txt1.width = 550; // Obtain 220 of the text txt width.
Txt1.filters = [new DropShadowFilter (, 0x0)]; // add a projection filter for text (distance 5, direction 45 degrees, color black)