How do i access objects on stage in a as3 class

hey im tring to access an object called “block” on my stage and i put this inside a class that my player is using
PLAYER CLASS

package {


	import flash.display.MovieClip;




	public class bot extends MovieClip
	{




		public function bot()
		{
			var cube = stage.getChildByName("block");
			if (cube.hitTestObject(this))
			{


			}
		}
	}


}

i got an error:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at bot()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()
at flash.display::Sprite/constructChildren()
at flash.display::Sprite()
at flash.display::MovieClip()

how do i fix this?