# Drawing a box with Actionscript

**URL:** <https://forum.kirupa.com/t/drawing-a-box-with-actionscript/222556>\
**Category:** flash\
**Created:** [April 14, 2007, 6:57pm UTC](https://forum.kirupa.com/t/drawing-a-box-with-actionscript/222556 "2007-04-14T18:57:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wahiche](https://avatars.discourse-cdn.com/v4/letter/w/da6949/32.png) [@wahiche](https://forum.kirupa.com/u/wahiche)\
**Post date:** [April 14, 2007, 6:57pm UTC](https://forum.kirupa.com/t/drawing-a-box-with-actionscript/222556/1 "2007-04-14T18:57:48Z")

</div>

Hello All,

I have seen some tutorials for this type of thing but not exactly what I was looking for. For instance this code here:

```auto
this.createEmptyMovieClip("rectangle_mc", 10);
rectangle_mc._x = 100;
rectangle_mc._y = 100;
drawRectangle(rectangle_mc, 240, 180, 0x99FF00, 100);
function drawRectangle(target_mc:MovieClip, boxWidth:Number, boxHeight:Number, fillColor:Number, fillAlpha:Number):Void {
    with (target_mc) {
        beginFill(fillColor, fillAlpha);
        moveTo(0, 0);
        lineTo(boxWidth, 0);
        lineTo(boxWidth, boxHeight);
        lineTo(0, boxHeight);
        lineTo(0, 0);
        endFill();
    }
}

```

It draws a box with a green fill but it just shows up. I would like to make it look like it is being drawn. Is there a way to do that with ActionScript or do I have to use masks and tweens?

Thanks in advance for your help.
