So I am trying to create a thing that I can drag, drop and rotate an image by click of the mouse. I have the click and drag part down, but how can I get it to rotate? I want to basically click the corner, and spin it clock or counter clockwise.
This is my code so far for the drag and drop
Code:
import flash.events.KeyboardEvent;
import flash.events.Event;
movieClip_1.addEventListener(MouseEvent.MOUSE_DOWN, fl_ClickToDrag_2);
function fl_ClickToDrag_2(event:MouseEvent):void
{
movieClip_1.startDrag();
}
stage.addEventListener(MouseEvent.MOUSE_UP, fl_ReleaseToDrop_2);
function fl_ReleaseToDrop_2(event:MouseEvent):void
{
movieClip_1.stopDrag();
}
stage.addEventListener(KeyboardEvent.KEY_DOWN, fl_PressKeyToMove_2);
function fl_PressKeyToMove_2(event:KeyboardEvent):void
{
switch (event.keyCode)
{
case Keyboard.UP :
{
movieClip_1.y -= 5;
break;
};
case Keyboard.DOWN :
{
movieClip_1.y += 5;
break;
};
case Keyboard.LEFT :
{
movieClip_1.x -= 5;
break;
};
case Keyboard.RIGHT :
{
movieClip_1.x += 5;
break;
}
}
};
Its pretty much what flash gave me.
If you can help that would be great.
Thanks.
|