922
ActionScript classes
Example
The following creates a movie clip that contains a 20-pixel line (which forms a border) and a
gradient fill. The movie clip scales based on the mouse position, and because of the
scale9Grid
set for the movie clip, the thickness of the 20-pixel line does not vary when the
movie clip scales (although the gradient in the movie clip
does
scale):
import flash.geom.Rectangle;
import flash.geom.Matrix;
this.createEmptyMovieClip("my_mc", this.getNextHighestDepth());
var grid:Rectangle = new Rectangle(20, 20, 260, 260);
my_mc.scale9Grid = grid ;
my_mc._x = 50;
my_mc._y = 50;
function onMouseMove()
{
my_mc._width = _xmouse;
my_mc._height = _ymouse;
}
my_mc.lineStyle(20, 0xff3333, 100);
var gradient_matrix:Matrix = new Matrix();
gradient_matrix.createGradientBox(15, 15, Math.PI, 10, 10);
my_mc.beginGradientFill("radial", [0xffff00, 0x0000ff],
[100, 100], [0, 0xFF], gradient_matrix,
"reflect", "RGB", 0.9);
my_mc.moveTo(0, 0);
my_mc.lineTo(0, 300);
my_mc.lineTo(300, 300);
my_mc.lineTo(300, 0);
my_mc.lineTo(0, 0);
my_mc.endFill();
See also
Rectangle (flash.geom.Rectangle)
Содержание FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Страница 1: ...ActionScript 2 0 Language Reference ...
Страница 1352: ...1352 ActionScript classes ...