3 Replies Latest reply on Nov 18, 2007 1:29 PM by kglad

    updating code

    *sanchez**
      can anyone help me update this code from flash 6 to flash 8?

      [CODE]

      //this is a prototype to smoothly scroll a clip to a certain position
      //the parameters within the ( ) must be provided when calling the prototype
      Movieclip.prototype.scrollme = function(xPos, yPos) {
      //this get the current X position of the clip calling the function
      cX = this._x;
      //this works out the distance between its current X position and where it has to go
      difX = cX-xPos;
      //this sets the new X position of the clip
      //in this example, the clip moves 1/5th of the total distance every frame
      //because the total distance will get smaller every frame, so will the speed of the movement
      this._x = cX-(difX/5);
      //the actions below do the same as the ones above except along the y axis
      cY = this._y;
      difY = cY-yPos;
      this._y = cY-(difY/5);
      };

      //set the starting value of a variable
      arrayIndex = 0;
      //make a couple of arrays to hold the x and y positions for our clip
      //more arrays
      onemcXpositions=new Array (50,280,50,50,50,50,50);
      onemcYpositions=new Array (350,159 ,350,350,350,350,350);

      twomcXpositions=new Array (145,145,280,145,145,145,145);
      twomcYpositions=new Array (350,350,159 ,350,350,350,350);

      threemcXpositions=new Array(240,240,240,280,240,240,240);
      threemcYpositions=new Array(350,350,350,159,350,350,350);

      fourmcXpositions=new Array (335 ,335,335,335,280,335,335);
      fourmcYpositions=new Array (350,350,350,350,159 ,350,350);

      fivemcXpositions=new Array (430,430,430,430,430,280,430);
      fivemcYpositions=new Array (350,350,350,350,350,159,350);

      sixmcXpositions=new Array (525,525,525,525,525,525,280);
      sixmcYpositions=new Array (350,350,350,350,350,350,159);

      //set the scrolling animation for the mcs

      onemc.onEnterFrame = function() {
      this.scrollme(onemcXpositions[arrayIndex],onemcYpositions[arrayIndex]);
      };
      twomc.onEnterFrame = function() {
      this.scrollme(twomcXpositions[arrayIndex],twomcYpositions[arrayIndex]);
      };
      threemc.onEnterFrame = function() {
      this.scrollme(threemcXpositions[arrayIndex],threemcYpositions[arrayIndex]);
      };
      fourmc.onEnterFrame = function() {
      this.scrollme(fourmcXpositions[arrayIndex],fourmcYpositions[arrayIndex]);
      };
      fivemc.onEnterFrame = function() {
      this.scrollme(fivemcXpositions[arrayIndex],fivemcYpositions[arrayIndex]);
      };
      sixmc.onEnterFrame = function() {
      this.scrollme(sixmcXpositions[arrayIndex],sixmcYpositions[arrayIndex]);
      };


      //set the button actions
      _root.one.onRelease=function(){
      arrayIndex=1;
      }
      _root.two.onRelease=function(){
      arrayIndex=2;
      }
      _root.three.onRelease=function(){
      arrayIndex=3;
      }
      _root.four.onRelease=function(){
      arrayIndex=4;
      }
      _root.five.onRelease=function(){
      arrayIndex=5;
      }
      _root.six.onRelease=function(){
      arrayIndex=6;

      }

      [/CODE]