# Graphics.drawRect not working?

**URL:** https://forum.kirupa.com/t/graphics-drawrect-not-working/281682
**Category:** Uncategorized
**Created:** [February 12, 2009, 4:48am UTC](https://forum.kirupa.com/t/graphics-drawrect-not-working/281682 "2009-02-12T04:48:55Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![SpawnOfJon](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/spawnofjon/32/3308_2.png) [@SpawnOfJon](https://forum.kirupa.com/u/SpawnOfJon)
#### Post date: [February 12, 2009, 4:48am UTC](https://forum.kirupa.com/t/graphics-drawrect-not-working/281682/1 "2009-02-12T04:48:55Z")

</div>

I’m trying to draw a shape but am having a weird issue. I’m not getting any errors, but no shape will show up. I get a blank white canvas when I run the .swf with the following class:

```auto
package {
    
    import flash.display.DisplayObject;
    import flash.display.Graphics;
    import flash.display.Shape;
    import flash.display.Sprite;
    
    public class BarGraph extends Sprite {
    
        public function BarGraph () {
            drawBar();
        }
        
        private function drawBar():void{
            var bar:Shape = new Shape();
            bar.graphics.beginFill(0x000000);
            bar.graphics.lineStyle(2, 0x333333);
            bar.graphics.drawRect(10, 10, 50, 300);
            bar.graphics.endFill();
            addChild(bar);
        }
    }
}

```

Can someone point out what I’m missing? Much thanks!

Jon
