03.05.2013 Views

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

ActionScript 2.0 Language Reference - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

lineTo(100, 300);<br />

lineTo(300, 300);<br />

lineTo(300, 100);<br />

lineTo(100, 100);<br />

endFill();<br />

}<br />

This code draws the following image onscreen:<br />

spreadMethod:String [optional] - Added in Flash Player 8. Either "pad", "reflect," or<br />

"repeat," which controls the mode of the gradient fill. The default value is "pad".<br />

For example, consider a simple linear gradient between two colors:<br />

import flash.geom.*;<br />

var fillType:String = "linear"<br />

var colors:Array = [0xFF0000, 0x0000FF];<br />

var alphas:Array = [100, 100];<br />

var ratios:Array = [0x00, 0xFF];<br />

var matrix:Matrix = new Matrix();<br />

matrix.createGradientBox(20, 20, 0, 0, 0);<br />

var spreadMethod:String = "pad";<br />

this.beginGradientFill(fillType, colors, alphas, ratios, matrix,<br />

spreadMethod);<br />

this.moveTo(0, 0);<br />

this.lineTo(0, 100);<br />

this.lineTo(100, 100);<br />

this.lineTo(100, 0);<br />

this.lineTo(0, 0);<br />

this.endFill();<br />

This example uses "pad" for the spread method, so the gradient fill looks like the following:<br />

MovieClip 849

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!