16 Replies Latest reply on Nov 15, 2007 8:56 AM by kglad

    Vertical carousel

    l_u_b_i_007
      I was trying to do one with amended code from gotoandlearn, however, can't get the scaling to work properly.

      var numOfBalls:Number = 3;
      var radiusX:Number = 0;
      var radiusY:Number = 200;
      var centerX:Number = Stage.width / 2;
      var centerY:Number = Stage.height / 2;
      var speed:Number = 0.05;

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

      function mover()
      {
      this._x = Math.cos(this.angle) * radiusX + centerX;
      this._y = Math.sin(this.angle) * radiusY + centerY;
      var s = this._x /(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)/1500;
      }

      anybody??

      cheers
      L.