Setting up abstract classes

Sorry for this real noobie question.

I want to break my code into several classes for the sake of readability and reusability, but I keep getting various errors for code that works perfectly well when it’s all contained in the DocClass.

Where am I going wrong?

DocClass:

package main
{
	import flash.display.Sprite;
	import flash.events.Event;
	import main.Grid;
	
	public class DocClass extends Sprite
	{
		public var test:Test = new Test();
		
		public function DocClass():void
		{
			trace(this+" initalized");
			addChild(test);
			addEventListener(Event.ENTER_FRAME, testEvent);
		}
		
		public function testEvent(e:Event):void
		{
			test.x = Grid.gridX(mouseX);
			test.y = Grid.gridY(mouseY);
		}
	}
}

Grid:

package main
{
	public class Grid extends Object
	{
		private const minGridX:int = 16;
		private const minGridY:int = 16;
		private const maxGridX:int = 624;
		private const maxGridY:int = 464;

		public function gridX(X:Number):int
		{
			X = Math.floor(X / 8) * 8;
			if (X < minGridX) X = minGridX;
			if (X > maxGridX) X = maxGridX;
			return X;
		}
		
		public function gridY(Y:Number):int
		{
			Y = Math.floor(Y / 8) * 8;
			if (Y < minGridY) Y = minGridY;
			if (Y > maxGridY) Y = maxGridY;
			return Y;
		}
	}
}

Thanks