I am trying to get different movie clips to drag and rotate independently on the stage
I have found code on the internet which has just one movie in it and does just what I want but when I add a second movie they drag independently but rotate simultaneously. Can anyone tell me where I am going wrong please.
Movie 1
stage.addEventListener(KeyboardEvent.KEY_DOWN, nextQuestion);
function nextQuestion(event:KeyboardEvent):void {
//trace(event.keyCode);
if(event.keyCode == Keyboard.RIGHT)
{
dragObject.rotation += 5;
}
if(event.keyCode == Keyboard.LEFT)
{
dragObject.rotation -= 5;
}
}
dragObject.addEventListener(MouseEvent.MOUSE_DOWN, dragIt);
function dragIt(evt:MouseEvent):void {
dragObject.startDrag();
}
dragObject.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function dropIt(evt:MouseEvent):void {
dragObject.stopDrag();
}
Movie 2
stage.addEventListener(KeyboardEvent.KEY_DOWN, nextQues);
function nextQues(event:KeyboardEvent):void {
//trace(event.keyCode);
if(event.keyCode == Keyboard.RIGHT)
{
dragObject.rotation += 5;
}
if(event.keyCode == Keyboard.LEFT)
{
dragObject.rotation -= 5;
}
}
dragObject.addEventListener(MouseEvent.MOUSE_DOWN, drag);
function drag(evt:MouseEvent):void {
dragObject.startDrag();
}
dragObject.addEventListener(MouseEvent.MOUSE_UP, drop);
function drop(evt:MouseEvent):void {
dragObject.stopDrag();
}
Thank you