9 Replies Latest reply on Aug 13, 2007 4:27 PM by kglad

    Stop speed of  onMouseMove

    jtouhey
      I have a 15fps movie that is 255 frames long (15 second linear animation). I have a carousel effect starting on frame 45 with the following actions:

      //for product carousel effect

      var numOfItems:Number = 4;
      var radiusX:Number = 100;
      var radiusY:Number = 75;
      var centerX:Number = Stage.width/2;
      var centerY:Number = Stage.height/2;
      var speed:Number = 0.00;

      for (var i=0;i<numOfItems;i++)
      {
      var t = this.attachMovie("productholder_mc", "productholder_mc"+i, i+1);
      t.angle = i * ((Math.PI*2)/numOfItems);
      t.onEnterFrame = mover;
      }

      function mover ()
      {
      this._x = Math.cos(this.angle) * radiusX + centerX;
      this._y = Math.sin(this.angle) * radiusY + centerY;
      var s:Number = this._y / (centerY+radiusY);
      this._xscale = this._yscale = s * 100;
      this.angle += this._parent.speed;
      this.swapDepths(Math.round(this._xscale) + 100);
      }

      this.onMouseMove = function ()
      {
      speed = (this._xmouse-centerX)/1000;
      }

      // end product carousel effect

      The carousel works fine, but since this is a banner ad, there cannot be any animation after 15 seconds. I want the carousel to only work when moused over, and to pause/stop when you mouse outside of the swf, but! resume when moused over.

      I added the following action to a transparent button over the entire movie to stop the speed of the carousel when you mouse away from the .swf:

      // stop carousel from spinning when you mouse away from the .swf
      on (rollOut) {
      speed = (this._xmouse-centerX)/0000;
      }

      This stops the carousel from spinning, but when you mouse back over the .swf, the carousel does not move anymore!! Does anyone have any suggestions? Thanks!!