# Convert AS2 to AS3

**URL:** <https://forum.kirupa.com/t/convert-as2-to-as3/315260>\
**Category:** Uncategorized\
**Created:** [October 21, 2010, 8:19am UTC](https://forum.kirupa.com/t/convert-as2-to-as3/315260 "2010-10-21T08:19:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kadaj](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/kadaj/32/9061_2.png) [@kadaj](https://forum.kirupa.com/u/kadaj)\
**Post date:** [October 21, 2010, 8:19am UTC](https://forum.kirupa.com/t/convert-as2-to-as3/315260/1 "2010-10-21T08:19:30Z")

</div>

```auto

wSize = Stage.width;
hSize = Stage.height;
fillType = "linear";
colors = [0xFF0000, 0xFFFF00];
alphas = [100, 100];
ratios = [0, 255];
matrix = {matrixType:"box", x:0, y:0, w:wSize, h:hSize, r:90/180*Math.PI};
_root.lineStyle(1, 0xFFFFFF, 0);
_root.beginGradientFill(fillType, colors, alphas, ratios, matrix);
_root.lineTo(wSize, 0);
_root.lineTo(wSize, hSize);
_root.lineTo(0, hSize);
_root.lineTo(0, 0);
_root.endFill();

```

The problem I’m facing is that the matrix variable. Above its like an object. But in AS3 the beginGradientFill requires a matrix as its parameter.  
Thanks
