2 Replies Latest reply on Nov 5, 2006 7:56 AM by kglad

    non-liner changing of _alpha property

      I have following problem: I try to modify _alpha property of an object using AS, increasing the _alpha value non-linearily

      I have three frames movie.

      On the fisrt frame there is a mc called "OBJECT", with _alpha set to "0", plus this AS:

      speed = 10;

      beg = OBJECT._alpha;
      end = 100;
      difference = end-beg;
      move = difference/speed;
      OBJECT._alpha = beg+move;

      on the second frame I ask if the _apha value has already reached the "end" value (which is set on the first frame), if NOT I go back for the first frame and if YES I would continue my movie

      if (OBJECT._alpha<(end-1)){
      } else {

      BUT thing is that the _alpha value NEVER reach the "end" value set on the first frame. Just in case the "speed" value is set for "2", every other value DOES NOT WORK ... and that is the question - WHY?

      thanks for any helps

        • 1. Re: non-liner changing of _alpha property
          gringito Level 1
          well! :) I found the problem by myself. so do not reply - its been solved.

          If anyone is interested where was the trouble:
          it seems that flash does not allow _alpha to be added values less than "1". (0.756 for example). for that reason my AS never reached the "end" value.
          • 2. Re: non-liner changing of _alpha property
            kglad Adobe Community Professional & MVP
            that's not correct. flash represents the alpha as a number from 0 to 255 and that's not relevent to your problem.

            what is causing your problem is that flash allows only 8 significant digits to represent an object's alpha and you chose a series of alpha's that converge too slowly. if you'd chosen speed = 2 (or 3) you'd have no problem.

            or if you'd performed your increments on a variable that stored the alpha you would realize the usual flash 15 digit accuracy and could have used speed = 10.