two
colors:</p>
<pre><code class="prettyprint haxe">import openfl.geom.*;
import openfl.display.*;

var fillType = GradientType.LINEAR;
var colors = [0xFF0000, 0x0000FF];
var alphas = [1, 1];
var ratios = [0x00, 0xFF];
var matr = new Matrix();
matr.createGradientBox(20, 20, 0, 0, 0);
var spreadMethod = SpreadMethod.PAD;
graphics.beginGradientFill(fillType, colors, alphas, ratios, matr, spreadMethod);
graphics.drawRect(0,0,100,100);</code></pre>
<p>This example uses <code><a href="../../openfl/display/Spread