1 // makeswf -v 7 -s 200x150 -r 1 -o gradient-beginGradientFill.swf gradient-beginGradientFill.as
6 function do_gradient
(type
, colors
, alphas
, ratios
) {
7 var matrix
= { a
:0, b
:-80, d
:80, e
:0, g
: x
* 100 + 50, h
: y
* 100 + 50 };
8 beginGradientFill
(type
, colors
, alphas
, ratios
, matrix
);
9 moveTo
(x
* 100 + 10, y
* 100 + 10);
10 lineTo
(x
* 100 + 10, y
* 100 + 90);
11 lineTo
(x
* 100 + 90, y
* 100 + 90);
12 lineTo
(x
* 100 + 90, y
* 100 + 10);
13 lineTo
(x
* 100 + 10, y
* 100 + 10);
23 foo
= function (o
, s
) {
28 trace
(s
+ " valueof: " + o
.x
);
32 c
.length
= { valueOf
: function () { return foo
(this, "color"); } };
33 c
[0] = c
[2] = c
[4] = c
[6] = c
[8] = 0xFF;
34 c
[1] = c
[3] = c
[5] = c
[7] = c
[9] = 0xFF00;
36 a
.length
= { valueOf
: function () { return foo
(this, "alpha"); } };
37 a
[0] = a
[2] = a
[4] = a
[6] = a
[8] = 100;
38 a
[1] = a
[3] = a
[5] = a
[7] = a
[9] = 50;
40 r
.length
= { valueOf
: function () { return foo
(this, "ratios"); } };
41 for (i
= 0; i
< 10; i
++)
43 do_gradient
("linear", c
, a
, r
);
47 o
.length
= { valueOf
: function () { trace
("length valueOf"); return 3; } };
48 do_gradient
("linear", [0x40, 0xFF0000, 0xFF00], o
, [0, 127, 255]);
49 do_gradient
("linear", [0xFF, 0xFF0000, 0xFF00], [100, 100, 100], o
);
50 do_gradient
("linear", o
, [100, 50, 100], [0, 127, 255]);
53 do_gradient
("Radial", [0xFF, 0xFF0000, 0xFF00], [255, 255, 255], [0, 127, 255]);
54 do_gradient
("linear", ["255", {valueOf
: function () { return 0xFF0000; }}, 0xFF00], [255, 255, 255], [0, 127, 255]);
55 do_gradient
("linear", [ 0xFF, 0xFF00 ], [ undefined, 127 ], [ 0, 255 ]);
56 do_gradient
("linear", [ ], [ ], [ ]);
57 do_gradient
("linear", [ 0xFF ], [ 100 ], [ -1 ]);
58 do_gradient
("linear", [ undefined ], [ 100 ], [ 255.8 ]);
59 do_gradient
("linear", [ 0xFF ], [ 100 ], [ 256 ]);
60 do_gradient
("radial", [0xFF, 0xFF0000, 0xFF00], [50, 100, 255], [undefined, 127, 255]);