Flex and Flash, Flash and Flex

I’ve been going through the ActionScript 3 cookbook from O’Reily and the fist 30 some odd scripts are made in Flex builder 2.

I’m trying to convert some of the classes I’ve made into flash compatiple ones and am running into nothing but problems.

Here is the class code:

package {
	import flash.display.Sprite;
	import flash.events.MouseEvent;

	public class SimpleDrawingApp extends Sprite
	{
		private var _sprite:Sprite;
		
		public function SimpleDrawingApp()
		{
			_sprite = new Sprite();
			addChild(_sprite);
			_sprite.graphics.beginFill(0xffffff);
			_sprite.graphics.drawRect(0,0,400,400);
			_sprite.graphics.endFill();
			
			_sprite.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
			_sprite.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
		}
		
		private function onMouseDown(event:MouseEvent):void{
			_sprite.graphics.lineStyle(5,0,1);
			_sprite.graphics.moveTo(mouseX,mouseY);
			_sprite.addEventListener(MouseEvent.MOUSE_MOVE,onMouseMove);
		}
		
		private function onMouseUp(event:MouseEvent):void{
			_sprite.removeEventListener(MouseEvent.MOUSE_MOVE,onMouseMove);
		}
		
		private function onMouseMove(event:MouseEvent):void{
			_sprite.graphics.lineTo(mouseX,mouseY);
		}
	}
}

Here is the FLA code:

var drawingApp:SimpleDrawingApp = new SimpleDrawingApp;

and this is the error I get:

Warning: 1090: Migration issue: The onMouseDown event handler is not triggered automatically by Flash Player at run time in ActionScript 3.0. You must first register this handler for the event using addEventListener ( ‘mouseDown’, callback_handler).