1 Reply Latest reply on Jun 29, 2006 12:20 PM by Jan-Paul K.

    converting as1 to as2

      Hiya all!
      Could some one please help:

      This actionscript is not working.
      I have to convert a movieclip that was produced in actionscript1 using flash6 settings into
      actionscript2 using flash7 settings. It does not seem to work when I insert it into flash8
      the actionscript is:

      function SlideMenu() {
      this._x += (newX-this._x)/5;
      this._y += (newY-this._y)/5;
      }
      // This next line calls the funtion named SlideMenu
      WindowIN.Contents.onEnterFrame = SlideMenu;
      newX = 0;
      newY = 0;
      //The next line is where you indicate the total number of display area(s)
      PageTotal = 3;
      //This is where we set our counter to 1
      //The counter later limits the count to a maximum of the number set in PageTotal
      CounterDisplay = 1;
      //The following function is assigned to the Forward button
      Forward.Forward.onPress = function() {
      CounterNumber++;
      XNumber++;
      // limit input field to a maximum as indicated above in PageTotal
      if (CounterNumber>PageTotal-1) {
      CounterNumber = 0;
      XNumber = 0;
      YNumber = 0;
      }
      CounterDisplay = CounterNumber+1;
      if (XNumber>9) {
      XNumber = 0;
      YNumber++;
      }
      newX = -XNumber*53;
      newY = -YNumber*50;
      };
      //This is a similar function for the Back button except in reverse
      Back.Back.onPress = function() {
      CounterNumber--;
      XNumber--;
      if (CounterNumber<0) {
      CounterNumber = PageTotal-1;
      XNumber = 9;
      YNumber = 9;
      }
      CounterDisplay = CounterNumber+1;
      if (XNumber<0) {
      XNumber = 9;
      YNumber--;
      }
      newX = -XNumber*0;
      newY = -YNumber*0;
      };


      Does anyone have a suggestion/solution?
      Thanks!


        • 1. Re: converting as1 to as2
          Jan-Paul K. Level 1
          usually there is no need to convert as1 to as2, since all flash players are backwards compatible,
          I think think internally they even still use the as1 syntax...well its compiled to bytecode anyway, but I think AS2 classes are transformed to _global functions when compiled.

          does flash give you any hints on ActionScript errors (in the actionscript view or when you test the movie)?

          Icould imagine your code is not wokring because you forgot to give instance names to all mc's, but this is just a guess.
          It depends strongly on the movieclip structure if the bve code works or not, since all the referenes need to be correct.
          hope this helps a bit
          paul