Copy link to clipboard
Copied
I have an animation im working on, a series of images, placed in individual keyframes, that is rotatable by clicking down and dragging left or right.
My actionscript is solid when viewed in flash's desktop player. The problem is the client views it in whatever web browser he uses, and when viewed in a web browser, the MOUSE_DOWN action causes the image to progress without regard to the mouseX rule.
This is making me pull my hair out, so here is my code, any help would be appreciated:
stop();
stage.addEventListener(MouseEvent.MOUSE_DOWN, mDown);
stage.addEventListener(MouseEvent.MOUSE_UP, mUp);
var prevMouseX:int;
function mDown(event:MouseEvent):void {
prevMouseX = stage.mouseX;
this.addEventListener(Event.ENTER_FRAME,mMove);
}
function mUp(event:MouseEvent):void {
this.removeEventListener(Event.ENTER_FRAME,mMove);
}
function mMove(event:Event):void {
var activeMouseX = stage.mouseX;
if (activeMouseX > prevMouseX){
if(currentFrame == 1){
gotoAndStop(totalFrames);
} else {
prevFrame()
}
}
if (activeMouseX < prevMouseX){
if(currentFrame == totalFrames) {
gotoAndStop(1);
} else {
nextFrame()
}
}
prevMouseX = stage.mouseX;
}
Copy link to clipboard
Copied
use the trace function to debug.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now