4 Replies Latest reply on Jun 14, 2017 3:37 PM by SilencedAnger

    Continuing Interactive Animation on Mouse Release

    SilencedAnger Level 1

      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

       

      So in the past few weeks is 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.

      It's also no problem if someone has a solution with Actionscript 3.0.

       

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

       

      mc.stop();

      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 {

      mc.gotoAndStop(travelDistance);

      }

      }

       

      I really appreciate your time and thank you very much already

       

       

       

      Ned Murphy CatSulzmann