# Class/draw problem

**URL:** <https://forum.kirupa.com/t/class-draw-problem/273567>\
**Category:** flash\
**Created:** [October 17, 2008, 1:20am UTC](https://forum.kirupa.com/t/class-draw-problem/273567 "2008-10-17T01:20:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ibanez1](https://avatars.discourse-cdn.com/v4/letter/i/3bc359/32.png) [@Ibanez1](https://forum.kirupa.com/u/Ibanez1)\
**Post date:** [October 17, 2008, 1:20am UTC](https://forum.kirupa.com/t/class-draw-problem/273567/1 "2008-10-17T01:20:00Z")

</div>

So I’m new to AS3 and the whole class thing in general, but I think I have most of it down… maybe. However, I’m plain lost as to what to do with this recent error. I’ve made a class method that draws a shape on the stage. I copied this code and pasted it into a new class I’m working on now that parses RSS feeds, but it doesn’t work in this new class, or at least not how I wanted it to work. I’ve included all the necessary import statements, and I don’t get an error message running the script, it’s just that the shape doesn’t appear. WHY?!  
Here’s most of the code I’m using:

```auto
package
{
    import flash.display.Sprite;
    import flash.display.Shape;
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.IOErrorEvent;
    import flash.events.MouseEvent;
    import flash.text.TextField;
        import flash.text.TextFieldAutoSize;
    import flash.display.Graphics;
    import flash.display.Stage;
    
    public class myClass extends MovieClip
    {
        public var mySquare:Sprite;
        public var myCircle:Shape = new Shape();
        
        public function myClass():void
        {
            drawSquare();
        }
        
        private function drawSquare():void
        {
            mySquare = new Sprite();
            addChild(mySquare);
            mySquare.graphics.beginFill(0x0000FF, 1);
            mySquare.graphics.drawRect(0, 0, 100, 100);
            mySquare.graphics.endFill();
            trace(mySquare.x + " " + mySquare.y); //Outputs '0 0'
        }
        }
}

```

Call me crazy, but shouldn’t this work?

##EDIT: Well Im an idiot. I didn’t addchild() the instance of the class on the main timeline. Problem solved.  
var test:myClass = new myClass();  
addChild(test);
