0 Replies Latest reply on Apr 26, 2006 3:27 PM by n1kk15ha

    Camera View

    n1kk15ha
      Okay I'm trying this tutorial on kirupa.com that talks about 3D. I'm not advanced in actionscript at all. I need help understanding what's going wrong with this code. What is suppose to happen is you're suppose to be able to zoom in or your suroundings move. The URL is Here My code is below.

      onClipEvent(enterFrame)
      {
      origin = new Object();
      origin.x = 150;
      origin.y = 150;

      focalLength = 300;

      figureA.x = -50;
      figureA.y = 0;
      figureA.z = 0;
      figureA.dir = 1;

      speed = 20;

      backAndForth = function(){
      this.z += speed*this.dir;
      if (this.z > 500){
      this.z = 500;
      this.dir = -1;
      }else if (this.z < 0){
      this.z = 0;
      this.dir = 1;
      }

      var scaleRatio = focalLength/(focalLength + this.z);
      this._x = origin.x + this.x * scaleRatio;
      this._y = origin.y + this.y * scaleRatio;
      this._xscale = this._yscale = 100 * scaleRatio;
      this.swapDepths(-this.z);
      };

      figureA.onEnterFrame = backAndForth;
      }

      Someone please help me understand what I'm doing wrong.

      Thanks,
      Nikki