# AS3 root access

**URL:** <https://forum.kirupa.com/t/as3-root-access/207536>\
**Category:** flash\
**Created:** [November 18, 2006, 6:31pm UTC](https://forum.kirupa.com/t/as3-root-access/207536 "2006-11-18T18:31:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghjr](https://avatars.discourse-cdn.com/v4/letter/g/dec6dc/32.png) [@ghjr](https://forum.kirupa.com/u/ghjr)\
**Post date:** [November 18, 2006, 6:31pm UTC](https://forum.kirupa.com/t/as3-root-access/207536/1 "2006-11-18T18:31:04Z")

</div>

In one of senocular’s AS3 tips ([http://www.kirupa.com/forum/newthread.php?do=newthread&f=9](http://www.kirupa.com/forum/newthread.php?do=newthread&f=9)) he mentioned using a TopLevel class which would then be extending by the document class to create “global” root access. Instead of making my document class extend TopLevel, could I assign stage and root properties directly to the document class, from inside the constructor? For example:

```auto

package {

    import flash.display.MovieClip;
       
    public class MyDocumentClass extends MovieClip {

        public static var stage:Stage;
        public static var root:DisplayObject;        

        public function MyDocumentClass() {
            MyDocumentClass.stage = this.stage;
            MyDocumentClass.root = this;
        }
    }
}

```

EDIT: Or maybe not define those two properties at all, just reference MyDocumentClass.root from whichever class I need root access too?

Cheers,  
ghjr
