Dudes!

I want to be able to dynamically add and remove an event listener for the keyboard to the stage from a class but Im not sure how to do it. I've used code like this :

Code:
package
{
	import flash.events.*
	import flash.display.*
	public class Main {
		public function test() : void
		{
			stage.addEventListener (KeyboardEvent.KEY_DOWN, keyPressed);
			function keyPressed (event : KeyboardEvent) : void {
				trace("hello?")
			}
		}
	}
}
But when I come to compile it says stage is not defined. Does anyone know how I can access the stage from a class function or cant it be done?