Continuing Interactive Animation on Mouse Release


Hello, first of all this is my first time I created a discussion so please forgive me if I posted this in a wrong area :slight_smile:

So in the past few weeks I started to work with Adobe Flash Professional CS6 and a little bit with Actionscript.
Due to another forum I was able to create my desired interactive turntable animation which you can see on this linked website.
Though I’m not completely satisfied with the result, as my animation ends very abruptly.

I actually want it to continue for some frames when I release the mouse button like in this linked example, so I asked the person what specific code he used but he seems to be inactive. In the comment section he only wrote that he used Actionscript 2.0 to achieve this effect.

I hope anyone can help me with this problem as I simply can’t figure out how to achieve the desired effect.

Here is the code I used in my example with Actionscript 2.0:

var startX: Number;
var startFrame: Number;
var changeDistance: Number;
var travelDistance: Number;
mc.onPress = pressHandler;
mc.onRelease = releaseHandler;
mc.onReleaseOutside = releaseHandler;

function pressHandler(): Void {
  startX = mc._xmouse;
  startFrame = mc._currentframe;
  this.onMouseMove = moveHandler;

function releaseHandler(): Void {
  this.onMouseMove = null;

function moveHandler(): Void {
  changeDistance = Math.round((mc._xmouse - startX) / 15);
  travelDistance = startFrame + changeDistance;
  if (travelDistance > mc._totalframes) {
    mc.gotoAndStop(travelDistance % mc._totalframes);
  } else if (travelDistance < 0) {
    mc.gotoAndStop(mc._totalframes + (travelDistance % mc._totalframes));
  } else {

The following link leads to the forum where I got the code from. Every single part of the code is explained here, hope it helps.

I really appreciate your time and thank you very much already :wink: