# Draw in a Class

**URL:** <https://forum.kirupa.com/t/draw-in-a-class/324492>\
**Category:** flash\
**Created:** [August 24, 2011, 2:00am UTC](https://forum.kirupa.com/t/draw-in-a-class/324492 "2011-08-24T02:00:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![baggirl](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@baggirl](https://forum.kirupa.com/u/baggirl)\
**Post date:** [August 24, 2011, 2:00am UTC](https://forum.kirupa.com/t/draw-in-a-class/324492/1 "2011-08-24T02:00:44Z")

</div>

I have created a class:

```auto
package {
     import flash.display.*;
     import flash.events.*;

    public class nD extends Sprite {

        public function nD() {
            addEventListener(Event.ADDED_TO_STAGE, addedToStage);
        }

        private function addedToStage(event:Event):void {
            graphics.lineStyle(5, 0xff0000, 1);
            graphics.moveTo(100, 200);
            graphics.moveTo(100, 100); 
        }

    }

}

```

I have messed around placing the lines in different places, but no lines show up on the SWF stage no matter what I do.

I am missing something important, but I never seem to stumble upon it. I have tried “this” as a prefix. I have drawn and addChild in different orders.

Can anyone help with ideas about creating a class:Sprite and then drawing on it?
