1 Reply Latest reply on May 10, 2010 5:56 AM by Ned Murphy

    Cog rotation with buttons


      Hi there, I recently started creating a small banner with a cog positioned half on the canvas in constant rotation and multiple buttons placed on the cog so they spin on and off the canvas. Unfortunatey at a slow rotation something like 400 frames at 25/sec the cog jitters a lot, even more when more buttons are added.


      I was wondering if there was anyway to smooth out the tween for a nice non disruptive rotation and if there is anyway to cause the cog to slow down when hovering over a button. I can make it stop completely on a roll over and start again on a roll out but I was hoping for more of a speed decrease and have never worked with altering this before.


      Help much appreciated



        • 1. Re: Cog rotation with buttons
          Ned Murphy Adobe Community Professional & MVP

          If this involves a timeline animation, you'll want to switch to using an actionscript based animation.  If the rotation is constantly occuring, then you could use an enterFrame control to deal with constant incrementing of the cog's _rotation property.  When you want to slow things down you can just change the value of the _rotation increment.


          Just as an example for you to work from, create a new Flash file and in it draw some object and convert it to a movieclip with an instance name "cog".  With that object on the stage, place the following code on the timneline...


          var rotIncrement = 2;


          this.onEnterFrame = function(){
          cog._rotation += rotIncrement;


          cog.onRollOver = function(){
          rotIncrement = 1;


          cog.onRollOut = function(){
          rotIncrement = 2;