Flash CS3 worksheets - Exercise 5

Exercise 5 More Animation within Movie Clips

Objective – Create animation within a movie clip

  1. Comment out all the previous code use /* */
  2. Use the buttons and movie clips to practiseMouse Over Event, Mouse Out Event and Key Pressed Event
  3. On btn1. Create listener to listen to mouse CLICK, OVER, OUT EVENT they should look like the following.
    1. btn1.addEventListener(MouseEvent.CLICK, mouseClickHandler);
    2. btn1.addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
    3. btn1.addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
  4. Add a key press listener. For key press event, it is “stage” that has the listener.
    1. stage.addEventListener(KeyboardEvent.KEY_DOWN, keyboardDownHandler);
  5. Test and annotate the code
  6. Alter the code to experiment. For example, change the handler names (identifiers) if you wish. Add statements inside the handler functions such as movements, rotating, fade in or out, play or stop, grow or shrink.

(By George, updated August 2011)