Error #2109 when I try to click and drag to rotate image
I am trying to create 3D rotate turntable animation where I can click and drag left and right over the image of a product in order to rotate it. It's not a 3D object but more of clicking and scrubbing through a movie clip/images of the product from different angles. When I run the test on a browser it seems to work fine but when I run it on animate as .swf it will not rotate smoothly and give me the error below:
mouseDown
ArgumentError: Error #2109: Frame label 3.0500000000000043 not found in scene 3.0500000000000043.
at flash.display::MovieClip/gotoAndStop()
at dispenser_rotate8_fla::MainTimeline/onMouseMove()
ArgumentError: Error #2109: Frame label 4.050000000000004 not found in scene 4.050000000000004.
at flash.display::MovieClip/gotoAndStop()
......and so on
My goal is to make something like this: https://petchatz.com/
Below is my code:
import flash.events.MouseEvent;
import flash.display.MovieClip;
import flash.events.MouseEvent;
var startX: Number;
var startFrame: Number;
var changeDistance: Number;
var travelDistance: Number;
movieClip.stop();
movieClip.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
movieClip.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
function onMouseDown(event: MouseEvent): void {
trace("mouseDown");
startX = movieClip.mouseX;
startFrame = movieClip.currentFrame;
movieClip.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}
//"movieClip" is the instance name of my movieclip
function onMouseUp(event: MouseEvent): void {
trace("mouseUp");
movieClip.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}
function onMouseMove(event:MouseEvent): void {
changeDistance = movieClip.mouseX - startX;
travelDistance = startFrame + changeDistance;
if (travelDistance > movieClip.totalFrames) {
movieClip.gotoAndStop (travelDistance % movieClip.totalFrames);
} else if (travelDistance < 0) {
movieClip.gotoAndStop (movieClip.totalFrames + (travelDistance % movieClip.totalFrames));
} else {
movieClip.gotoAndStop (travelDistance);
}
}
I am very new to Animate and AS3 so any help would be much appreciated. Thanks!
