Skip navigation
Currently Being Moderated

How to rotate  movieclip with Drag and Drop?

Aug 6, 2012 1:05 AM

hello everybody,

 

 

i am working with drag and drop game.

i am done with drag and drop. now i have problem in totating the movieclip.

i want movie clip to be rotate using mouse drag. Not using Mouse Click.!!!!

 

Can any one provide me solution for this?

 
Replies
  • Currently Being Moderated
    Aug 6, 2012 4:07 AM   in reply to sachin_mak

    var isDrageen:Boolean;

    var lastX:Number;

    var lastY:Number;

    var dragX:Number;

    var dragY:Number;

     

    stage.addEventListener(MouseEvent.MOUSE_DOWN,down);

    stage.addEventListener(MouseEvent.MOUSE_UP,up);

    stage.addEventListener(MouseEvent.MOUSE_MOVE,mov);

    function down(e:MouseEvent):void{

        isDrageen=true;

        lastX=mouseX;

        lastY=mouseY;

    }

    function up(e:MouseEvent):void{

        isDrageen=false

    }

    function mov(e:MouseEvent):void{

        if(isDrageen){

            dragX=mouseX-lastX;

            dragY=mouseY-lastY;

            MC.rotationY+=dragX/1.65;

            MC.rotationX+=dragY/1.65;

                lastX=mouseX;

                lastY=mouseY;       

        }

    }

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points