Return to Snippet

Revision: 3261
at June 28, 2007 04:34 by mswallace

Initial Code
package {
	import flash.display.Sprite;

	public class ExampleApplication extends Sprite{
		private var _sprite:Sprite;
		public function ExampleApplication(){
			_sprite = new Sprite();
			addChild(_sprite);;, 0, 400, 400);;
			_sprite.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
			_sprite.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
		private function onMouseDown(event:MouseEvent):void{, 0, 1);, 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{, mouseY);

Initial URL

Initial Description
This code will show you how to write Mouse Events using AS3 and also some simple Drawing API as well.

Initial Title
Mouse Events a simple drawing application using AS3

Initial Tags
actionscript, api, 3

Initial Language
ActionScript 3