Random Numbers: Math.Random()

If your movie does not work properly, check the following:
  1. In the action window click the blue check mark to check the syntax.
  2. If there are any syntax errors, double click the error in the complier error window to highlight the line with the error in the action window.
  3. Fix all syntax errors.
  4. Make sure that all names match both in spelling and case: rolldice is NOT the same as rollDice.
  5. Make sure that the button is named btnRoll and that you used the same name in the code to add the event listener.
  6. Make sure that the dice are named die1 and die2.
  7. If the movie works, but the two die always have the same number, make sure that you did not skip the line where n is given a new value.
  8. Check the Die movie clip to make sure that each frame shows the right number of dots and has the square background.
Get Adobe Flash player Get Adobe Flash player
Download the movie to experiment.

NEXT: Add different flowers on click