flash on 2010-3-9
/**
* Copyright yaha ( http://wonderfl.net/user/yaha )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/36RZ
*/
package {
import flash.display.Sprite;
import flash.events.MouseEvent;
public class MoveCircle extends Sprite {
public function MoveCircle() {
var CIRCLE:Sprite=new Sprite();
CIRCLE.graphics.beginFill(Math.random()*0xffffff);
CIRCLE.graphics.drawCircle(0,0,50);
CIRCLE.graphics.endFill();
addChild(CIRCLE);
CIRCLE.x=232;
CIRCLE.y=232;
CIRCLE.buttonMode=true;
CIRCLE.addEventListener(MouseEvent.MOUSE_DOWN,onMD);
CIRCLE.addEventListener(MouseEvent.MOUSE_UP,onMU);
}
private function onMD(e:MouseEvent):void{
e.currentTarget.startDrag();
}
private function onMU(e:MouseEvent):void{
e.currentTarget.stopDrag();
}
}
}