3 Replies Latest reply on Dec 7, 2006 8:41 AM by kglad

    Script for bouncing ball not working

    geilezeit
      Following a book and the task "actionscript for a bouncing ball", but having some problem with the script. First part is OK. Make a ball as a movie clip and place left of stage. Enter script -
      onClipEvent(load){
      speedX = 5;
      }
      onClipEvent(enterFrame) {
      this._x += speedX;
      }
      The ball moves slowly from left to right and goes off screen.
      In the next part it doesn't work.
      To bounce the ball off the right wall and reverse it. Enter script -
      onClipEvent(load){
      speedX=5;
      }
      onClipEvent(enterFrame) {
      this._x += speedX;
      if (this._x >= 550) {
      speedX = .speedX;
      }
      }
      In output window I get the error -
      **Error** Scene=Scene 1, layer=Layer 1, frame=1:Line 7: Operator '=' must be followed by an operand
      speedX = .speedX;

      Total ActionScript Errors: 1 Reported
      Thanks for any tips on how to get this right.