06
Feb
08

Drag in AS3

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

You can place this code in an AS3 document or a custom class, your choice. Thanks to Matt for the snippet Full code after the jump.

AS3 click and drag example
function initDragger(mc:MovieClip):void

{

 mc.addEventListener(MouseEvent.MOUSE_DOWN, function (e:MouseEvent):void

 {

 	e.currentTarget.startDrag();

 });

 mc.addEventListener(MouseEvent.MOUSE_UP, function (e:MouseEvent):void

 {

 	e.currentTarget.stopDrag();

 });}

// Set up drag
initDragger(cir_mc);

Found this useful? How about buying me a coffee - simply click here.


3 Responses to “Drag in AS3”


  1. 1 mp Jun 3rd, 2008 at 7:51 pm

    thx! this is just what i needed!
    Your way of opening and closing scripts is a bit odd, but it works like a charm!!
    tnx again!

  2. 2 admin Jul 9th, 2008 at 4:30 pm

    Glad I could help….

  3. 3 Момchil Oct 16th, 2008 at 7:16 am

    I want to drag the movie clip on line path?

Leave a Reply




Close
E-mail It