Skip to main content
Participant
December 29, 2011
Question

play mc nextFrame and prevFrame as mouse coordinates change up and down on stage

  • December 29, 2011
  • 1 reply
  • 758 views

Hi there

I want to trigger via mouseDown a function that plays a 30 frame mc while the mouseX coordinate increases and the mouse Y decreases. Then when the mouseX coordinates decreases and mouseY increases ie. the mouse moves up on the stage - mc plays in reverse

So basically the movieClip is scrolled by the mousemovement. When the mouse is not moving mc stops at currentFrame

Much much appreciate any ideas I can get to make this work 🙂

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
December 29, 2011

this.addEventListener(MouseEvent.MOUSE_MOVE,f);

function f(e:MouseEvent):void{

var frame:int=frameF(e.stageX,e.stageY);

mc.gotoAndStop(frame);

}

function frameF(x:int,y:int):int{

return 1+Math.round((mc.totalFrames-1)*(x+y)/(stage.stageWidth+stage.stageHeight));

}

Participant
December 30, 2011

Hi Kglad
Thank you for your reply. It's not working quite right yet.
The idea is to make a page curl animation for a fla book.
Once mouseup then actual pageturn animation is triggered and then go to next page.

But before that, I want to toggle the the pageCurl Tween mc back and forth on mouseDown. (This happens on current page.)
The mouse must move from top right to bottom left on mc = 30 frames on mc.
Then from bottom left to top right of mc  - it plays for frame 30 to 1 in reverse.

I've added file here if you want to see
http://www.animations.co.za/flash/pageScroll.fla

kglad
Community Expert
Community Expert
December 30, 2011

i don't' download and correct files unless hired.