In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

dragdrop

Get Adobe Flash player
by kazuyuki 21 Feb 2010
    Embed
/**
 * Copyright kazuyuki ( http://wonderfl.net/user/kazuyuki )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/xVxW
 */

package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    public class DragDrop extends Sprite {
        public function DragDrop() {
            var circle:Sprite = new Sprite();
            circle.graphics.beginFill(0xff5500);
            circle.graphics.drawCircle(0,0,50);
            circle.graphics.endFill();
            
            circle.x = (stage.stageWidth/2);
            circle.y = (stage.stageHeight/2);
            addChild(circle);
            
         	circle.addEventListener(MouseEvent.MOUSE_DOWN,mouseDown);
         	circle.addEventListener(MouseEvent.MOUSE_UP,mouseUp);
            
        }
        private function mouseDown(e:MouseEvent):void{
        	e.currentTarget.startDrag();
        }
        private function mouseUp(e:MouseEvent):void{
        	e.currentTarget.stopDrag();
        }
        
    }
}