# beginGradientFill Rotate problem

**URL:** <https://forum.kirupa.com/t/begingradientfill-rotate-problem/184494>\
**Category:** flash\
**Created:** [April 5, 2006, 2:26pm UTC](https://forum.kirupa.com/t/begingradientfill-rotate-problem/184494 "2006-04-05T14:26:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![blacksrv](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@blacksrv](https://forum.kirupa.com/u/blacksrv)\
**Post date:** [April 5, 2006, 2:26pm UTC](https://forum.kirupa.com/t/begingradientfill-rotate-problem/184494/1 "2006-04-05T14:26:24Z")

</div>

I’m trying to rotate my gradient, but I can’t get this work, I need some help.

```auto
import flash.geom.Matrix;
this.createEmptyMovieClip("mShape", 1);
mShape._x = 100;
mShape._y = 100;
var mxBox:Matrix = new Matrix();
drawRoundedRectangle(mShape, 240, 180, 10, 0x99FF00, 100);
function drawRoundedRectangle(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, cornerRadius:Number, fillColor:Number, fillAlpha:Number):Void {
    with (target_mc) {
        moveTo(cornerRadius, 0);
  mShape.lineStyle(2, 0, 100, false, "none", "none", "round");
  mShape.beginGradientFill("linear", [0xFFFFFF, 0x1C232C, 0x232D38], [100, 100, 100], [0, 150, 200], mxBox, "reflect", "LinearRGB", 1);
  //beginFill(fillColor, fillAlpha);
        lineTo(boxWidth - cornerRadius, 0);
        curveTo(boxWidth, 0, boxWidth, cornerRadius);
        lineTo(boxWidth, cornerRadius);
        lineTo(boxWidth, boxHeight - cornerRadius);
        curveTo(boxWidth, boxHeight, boxWidth - cornerRadius, boxHeight);
        lineTo(boxWidth - cornerRadius, boxHeight);
        lineTo(cornerRadius, boxHeight);
        curveTo(0, boxHeight, 0, boxHeight - cornerRadius);
        lineTo(0, boxHeight - cornerRadius);
        lineTo(0, cornerRadius);
        curveTo(0, 0, cornerRadius, 0);
        lineTo(cornerRadius, 0);
        endFill();
    }
}

```

Thanks

---

<div class="post-metadata">

**Author:** ![RichL](https://avatars.discourse-cdn.com/v4/letter/r/e79b87/32.png) [@RichL](https://forum.kirupa.com/u/RichL)\
**Post date:** [April 6, 2006, 11:31am UTC](https://forum.kirupa.com/t/begingradientfill-rotate-problem/184494/2 "2006-04-06T11:31:17Z")

</div>

is this what you mean…

```auto

var rad = (Math.PI/2) //Rotation in Radians
var cosrad = Math.cos(rad);
var sinrad = Math.sin(rad);
var mxBox = new Matrix(cosrad,sinrad,-sinrad,cosrad,0,0);

```

---

<div class="post-metadata">

**Author:** ![blacksrv](https://avatars.discourse-cdn.com/v4/letter/b/bbce88/32.png) [@blacksrv](https://forum.kirupa.com/u/blacksrv)\
**Post date:** [April 6, 2006, 12:16pm UTC](https://forum.kirupa.com/t/begingradientfill-rotate-problem/184494/3 "2006-04-06T12:16:01Z")

</div>

yes!, thanks!
