0 Replies Latest reply on Jun 28, 2007 1:12 PM by ragnarok27

    Stop 3D rotation

    ragnarok27
      I need help with this file. here is a link to what the file looks like:

      http://www.itwithintegrity.com/

      I incorporated these orbs into a .fla file that I purchased online. I have changed a little bit of the action script, but it is basically the same. I need to be able stop the animation once the orb is clicked on. How do I go about doing this? Here is the code:

      var numItems = 3; // Number of items
      var focalLength = 600; // environmental constant
      var centerX = Stage.width/3; // Stage Center X
      var centerY = Stage.height/3.2; // Stage Center Y
      var shiftAmount=0; // Amount to shift for rotation
      var selectedMC = 0; // currently in front of user
      var radius = 200; // circle radius
      var maxSpeed = 9000; // circle animation speed

      // Create 3D camera
      this.initCamera = function(){

      // create camera object
      this.oCamera = new Object();

      // Set camera Properties
      this.oCamera.z = focalLength; // target camera z position
      this.oCamera.dz = 0; // initial camera z position
      this.oCamera.s = 10; // camera zoom speed

      this.onEnterFrame = function(){
      // Move Camera
      with(this.oCamera){
      dz += (z-dz)/s;
      }

      // shift angle of all clips
      shiftAmount = ( this["instance_mc_"+selectedMC].angle - 90)/maxSpeed;
      }

      // loop and create the numer of instances defined
      for(var i = 0; i<numItems;i++){

      // choose between 3 labrary items
      var itmeClip = (i);

      // attach movie
      this.attachMovie(itmeClip, "instance_mc_"+i,i);

      // Assign variable to the MovieClip
      clip = this["instance_mc_"+i];

      // define initial properties
      clip.x = 0; // initial x position
      clip.y = 0; // initial y position
      clip.angle = i*(360/numItems); // initial item angle

      // Set click
      clip.onRelease = gotoAndPlay("info");

      /// render
      clip.onEnterFrame = function(){

      // shift angle
      this.angle += (_xmouse - centerX)/80;

      // prevents to go over 360 back to 0
      this.angle%=360;
      // prevent to go under 0 back to 360
      this.angle = (this.angle<0) ? 360 : this.angle;

      // Transform angle degrees to radian value
      var radian = (this.angle*Math.PI/180);

      // Calculate x position value
      this.x = Math.cos(radian) * radius;
      // Calculate z position value
      this.z = centerY - Math.sin(radian)*radius;
      // tilt y position to reflect 3D
      this.y = _root.yscroll * Math.sin(radian) - 50;

      // Calculating actual scale values according to scale = dz/(z+dz) formula
      var scale = (this._parent.oCamera.dz - _root.zscroll*5)/(focalLength+this.z);

      // Position
      this._x = (this.x*scale) + centerX;
      this._y = (this.y*scale) + centerY;

      // set perspective adjustement
      var adj = (this.z*12)/radius;

      // set size
      this._xscale = this._yscale = (scale*100)-adj;

      // Swap depths
      this.swapDepths(scale*100);



      // blur (max quality is 15)
      this.tempFilter[0].quality = 15 - (scale*100/5.2);
      this.filters = this.tempFilter;

      }
      }
      }

      // Initiate instances in Camera
      initCamera();

      stop();

      Any help will be much appreciated. Thank you.