# I'm having trouble creating a linear gradient

**URL:** <https://forum.kirupa.com/t/im-having-trouble-creating-a-linear-gradient/258109>\
**Category:** flash\
**Created:** [April 21, 2008, 2:46am UTC](https://forum.kirupa.com/t/im-having-trouble-creating-a-linear-gradient/258109 "2008-04-21T02:46:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![tibberous](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@tibberous](https://forum.kirupa.com/u/tibberous)\
**Post date:** [April 21, 2008, 2:46am UTC](https://forum.kirupa.com/t/im-having-trouble-creating-a-linear-gradient/258109/1 "2008-04-21T02:46:11Z")

</div>

I am trying to create a linear gradient, with beginGradientFill.

I need it to be a solid color. The middle needs to have an alpha value, and both ends need to fade out to 0.

This is acting weird:

```php

            var backdrop:Sprite = new Sprite();
            backdrop.graphics.beginGradientFill('linear', [gradColor,gradColor,gradColor], [0,1,0], [0,128,255]);
            backdrop.graphics.drawRect(0, 0, 100, 60);
            addChild(backdrop);

```

Any idea why?
