Hi All,
I have myself in a situation where everything was perfect with mouse click and drag, keyboard events and zoom events.The project is:
A movieclip with images sequence: For Original background.
And other movieclips: aslo images sequence (Pngs)
They were all given separate mouse events and zoom and key events.
Now wen I click the button with concerned movieclip to function, only the png image seuence is rotating and the main mc is not.
What should I do to rotate both the activated whichever png mcs and main mc also with these.
I have this for every button and a mouse event and key event and zoom event added.
Below is the button function:
garage_horizon_btn.addEventListener(MouseEvent.CLICK,garage)
function garage(event:MouseEvent):void
{
garage_horizon_mc.gotoAndStop(rotationframe);
garage_horizon_mc.visible=true;
garage_horizon_mc.stop();
garage_moss_mc.visible=false;
garage_ocean_mc.visible=false;
gutter_ocean_mc.visible=false;
gutter_horizon_mc.visible=false;
gutter_moss_mc.visible=false;
main_mc.visible=false;
}
Below is the Mouse Event.
var rotationframe:int = 1;
var rotater:MovieClip = images_mc.garage_horizon_mc;
var offsetFrame:int = rotater.currentFrame;
var offsetX:Number = 0;
var percent:Number = 0;
rotater.addEventListener(MouseEvent.MOUSE_DOWN,startDragging);
rotater.addEventListener(MouseEvent.MOUSE_UP,stopDragging);
function startDragging(e:MouseEvent):void
{
rotater.addEventListener(MouseEvent.MOUSE_MOVE,drag);
offsetX = e.target.mouseX;
}
function stopDragging(e:MouseEvent):void
{
rotater.removeEventListener(MouseEvent.MOUSE_MOVE,drag);
offsetFrame = rotater.currentFrame;
}
function drag(e:MouseEvent):void
{
percent = (e.target.mouseX - offsetX)/rotater.width;
var frame:int = Math.round(percent*rotater.totalFrames) + offsetFrame +1;
while (frame>rotater.totalFrames)
{
frame -= rotater.totalFrames;
}
while (frame<=0)
{
frame += rotater.totalFrames;
}
rotater.gotoAndStop(frame);
rotationframe = images_mc.garage_horizon_mc.currentFrame;
}
Please help.
Thanks in advance.