# Accessing Stage from the Class

**URL:** <https://forum.kirupa.com/t/accessing-stage-from-the-class/228381>\
**Category:** flash\
**Created:** [June 7, 2007, 9:48am UTC](https://forum.kirupa.com/t/accessing-stage-from-the-class/228381 "2007-06-07T09:48:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dataxa](https://avatars.discourse-cdn.com/v4/letter/d/c0e974/32.png) [@dataxa](https://forum.kirupa.com/u/dataxa)\
**Post date:** [June 7, 2007, 9:48am UTC](https://forum.kirupa.com/t/accessing-stage-from-the-class/228381/1 "2007-06-07T09:48:38Z")

</div>

I got the following file Tiles.as

```auto

package{
    
    import flash.display.*;

    public class Tiles extends MovieClip{
       
        public var map:MovieClip = new MovieClip();
        
        private var stageSet:Stage;
        public function Tiles(stageRef:Stage):void{
            stageSet = stageRef;
        }
        /* i draw on map MC with drawing API and i want it to be shown on Stage (main frame), but i cant access it*/
        public function createMap():void{
            map.graphics.lineStyle(1,0x990000);
            map.graphics.moveTo(0,0);
            map.graphics.lineTo(100,100);
            stageSet.addChild(map);
        }
    }
}

```

and following code in Tiles.fla

```auto

var Tile:Tiles = new Tiles(Stage);
Tile.createMap();

```

and i get error like this :1067: Implicit coercion of a value of type Class to an unrelated type flash.display:Stage.
