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

drag_n_drop

Get Adobe Flash player
by bujal 26 Aug 2011
    Embed
/**
 * Copyright bujal ( http://wonderfl.net/user/bujal )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/i32s
 */

package {
    import flash.geom.Rectangle;
    import flash.events.MouseEvent;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            var ball:MovieClip=new MovieClip();
            ball.graphics.beginFill(0x00FF00,1);
            ball.graphics.drawCircle(150,200,30);
            ball.graphics.endFill();
            addChild(ball);
            ball.buttonMode=true;
            
            
            ball.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownEventListener);
            ball.addEventListener(MouseEvent.MOUSE_UP,mouseUpEventListener);
        }
        function mouseDownEventListener(e:MouseEvent):void
        {
            e.target.startDrag(false,new Rectangle(0,0,stage.stageWidth,stage.stageHeight));
        }
        function mouseUpEventListener(e:MouseEvent):void
        {
            e.target.stopDrag();
        }

    }
}