2 Replies Latest reply on Jul 12, 2008 1:29 PM by Shandy Elliott

    flash help

      Hi, im doing a game that have an object Ball. now if the ball goes out of bounds i want to know so i can remove a life.
      the problem is i dont know how to do it. i wrote an if that checks if the ball is out of bounds but i dont know where to put him .
      where can i iput him so the program will check it all the time?? thanks..
        • 1. Re: flash help
          kglad Adobe Community Professional & MVP
          you need to repeatedly execute that code (usually in the same loop that updates _root.ball's _x and _y properties).
          • 2. flash help
            Shandy Elliott Level 1
            To add to klgad, I would create a function that checks the bounds. Personally, I would use a little different script than you, but for this case, I will just use your code so you can integrate it into your fla document.

            You also may want to switch to frame labels instead of using frame numbers as a good habit. So, instead of saying gotoAndPlay(4), you would use gotoAndPlay("some frame label"). If you use frame numbers in all your "goto" scripts, if you ever have to add frames in front, you would have to go back through all your code and update the new frame numbers. It's just better practice. Also, without knowing how this game works, you may want to clear the interval once a ball goes out of bounds by adding clearInterval(checkBoundsInterval) after your gotoAndPlay() line. How are you scripting the movement of the ball?