# stageWidth?

**URL:** https://forum.kirupa.com/t/stagewidth/252453
**Category:** Uncategorized
**Created:** [February 20, 2008, 10:22am UTC](https://forum.kirupa.com/t/stagewidth/252453 "2008-02-20T10:22:10Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Pier25](https://avatars.discourse-cdn.com/v4/letter/p/4af34b/32.png) [@Pier25](https://forum.kirupa.com/u/Pier25)
#### Post date: [February 20, 2008, 10:22am UTC](https://forum.kirupa.com/t/stagewidth/252453/1 "2008-02-20T10:22:10Z")

</div>

This code works perfectly except when I make reference to the stage width/height.

I get a error like “TypeError: Error #1009: can’t make reference to a null object”

What’s going on?

(yes I’m a AS3 newbie)

```auto
package{
	import flash.display.MovieClip;
	import flash.display.Stage;
	
	public class circulo extends MovieClip{
		public var radio:Number;
			
		public function circulo(){
			radio = Math.floor(Math.random()*100);
			this.width = radio * 2;
			this.height = radio * 2;
			this.x = Math.floor(Math.random() * stage.stageWidth);
			this.y = Math.floor(Math.random() * stage.stageHeight);
		}
	}
}

```
