# Cannot have access to stage in document class

**URL:** https://forum.kirupa.com/t/cannot-have-access-to-stage-in-document-class/313433
**Category:** flash
**Created:** [August 30, 2010, 6:17am UTC](https://forum.kirupa.com/t/cannot-have-access-to-stage-in-document-class/313433 "2010-08-30T06:17:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![bcapecci](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@bcapecci](https://forum.kirupa.com/u/bcapecci)
#### Post date: [August 30, 2010, 6:17am UTC](https://forum.kirupa.com/t/cannot-have-access-to-stage-in-document-class/313433/1 "2010-08-30T06:17:26Z")

</div>

Just tried using cs5 on my new macbook and I have a tlf text object on the stage with an instance name of mText. I tried to access (mText.text = “test”) it like this and got a null object reference. I tried to trace the stage from my document class and it was null when the tlftextbox was on the stage but i could trace stage correctly when I deleted the textbox. Please help and thanks

```auto

package {

	import flash.display.MovieClip;
	import flashx.textLayout.elements.TextFlow;

	public class WriteCode extends MovieClip{

		public function WriteCode() {
			trace(stage);			
		}

	}
	
}

```
