Graphics – Flash ActionScript

Hours 8 and 9

This laboratory session will cover

·  Understanding and adapting ActionScript

·  Selectable movie clips

·  Dragging movie clips

·  Keyboard-controlled movie clips

·  User input and functions

1 Keypad lock

Open 08kepad.

How to play the game – guess the 3 figure code

Hit three keys

Hit # to test

Text box will say Correct Code or Wrong Code

Hit * to clear selection

Look at the program code. What is the right answer?

Task 1: Change the code so that 6,7,8 is the right code.

Task 2: Change the code so that guessing the correct code will take you to frame 2. Frame 2 should contain congratulatory message/picture.

Hint 1: p.69 shows you how to jump from frame to frame (use a GotoAndStop(2); code).

Hint 2: Now your movie has two frames you need to put in a stop() code. The stop code needs to be at the start of frame 1 of the timeline. (As you did in the slideshow example on p73, step 5.)

2 Matching Game

Open 08matchinggame.

Play the game and then look at the scripts.

Task 3: Adapt the game – use your own pictures/words.

Task 4: Change the code so that guessing the correct code will take you to frame 2. Frame 2 should contain congratulatory message/picture.

3 Keyboard-Controlled Movie Clips

Page 129. Complete the Task: Keyboard-Controlled Movie Clips starting at the bottom of page 129 and going on to p130.

Task 5: Use this code to adapt the matching game. Alter the matching game so that the Pb movie clip is keyboard-controlled rather than operated by dragging. (The other movie clips remain draggable.)

4 User Input and Functions

Page 134. Work through Task: User Input starting at bottom of page 134 and finishing on page 136.

Task 6: Design a form that asks for the user’s name and then the text box should print Have a good day <user’s name>.

Mary Aylmer