2 Replies Latest reply on Aug 25, 2006 11:42 AM by paulpsd7

    Debug a small piece of code

    paulpsd7
      I'm working on some scrolling arrows that move a Movie Clip up and down until they reach their maximum length. It works on moving the movie clip up, but it doesn't stop at the maximum height, but keeps right on going. Here's the frame code:

      topspan = -560;
      bottomspan = 7.8;
      scrollstep = 10;



      Here's the button code:

      on (rollOver) {
      if (_root.predes._y > topspan) {
      onEnterFrame = function () {
      _root.predes._y = _root.predes._y - scrollstep;
      trace ("PREDES Y: " + _root.predes._y + " is greater than " + topspan);
      }
      } else {
      onEnterFrame = null;
      }
      }

      on (rollOut, dragOut, releaseOutside ) {
      onEnterFrame = null;
      }


      The trace command shows me what's going on. _root.predes._y gets lower and lower, until eventually it is less than topspan. At that point, it should do the "else" statement and set onEnterFrame to null. But it doesn't do that. Instead, I get a trace statement that says "PREDES Y: -662.2 is greater than -560".

      The rollout/dragout/releaseoutside code works fine.