562
Chapter 7: ActionScript for Flash
Example
The following example creates a square with red fill on the Stage.
this.createEmptyMovieClip("square_mc", this.getNextHighestDepth());
square_mc.beginFill(0xFF0000);
square_mc.moveTo(10, 10);
square_mc.lineTo(100, 10);
square_mc.lineTo(100, 100);
square_mc.lineTo(10, 100);
square_mc.lineTo(10, 10);
square_mc.endFill();
See also
MovieClip.beginGradientFill()
,
MovieClip.endFill()
MovieClip.beginGradientFill()
Availability
Flash Player 6.
Usage
my_mc
.beginGradientFill(
fillType:String
,
colors:Array
,
alphas:Array
,
ratios:Array
,
matrix:Object
)
: Void
Parameter
fillType
Either the string
"
linear
"
or the string
"
radial
"
.
colors
An array of RGB hex color values to be used in the gradient (for example, red is
0xFF0000, blue is 0x0000FF, and so on).
alphas
An array of alpha values for the corresponding colors in the
colors
array; valid values
are 0–100. If the value is less than 0, Flash uses 0. If the value is greater than 100, Flash uses 100.
ratios
An array of color distribution ratios; valid values are 0–255. This value defines the
percentage of the width where the color is sampled at 100 percent.
matrix
A transformation matrix that is an object with either of the following two sets of
properties.
•
a
,
b
,
c
,
d
,
e
,
f
,
g
,
h
,
i
, which can be used to describe a 3 x 3 matrix of the following form:
a b c
d e f
g h i
The following example uses a
beginGradientFill()
method with a
matrix
parameter that is
an object with these properties.
this.createEmptyMovieClip("gradient_mc", 1);
with (gradient_mc) {
colors = [0xFF0000, 0x0000FF];
alphas = [100, 100];
ratios = [0, 0xFF];
matrix = {a:200, b:0, c:0, d:0, e:200, f:0, g:200, h:200, i:1};
beginGradientFill("linear", colors, alphas, ratios, matrix);
Summary of Contents for FLEX
Page 1: ...Flex ActionScript Language Reference ...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0 ...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally ...
Page 135: ...case 135 See also break default strict equality switch ...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while ...
Page 808: ...808 Chapter 7 ActionScript for Flash ...
Page 810: ...810 Appendix A Deprecated Flash 4 operators ...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code ...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values ...
Page 822: ...822 Index ...