Mouse/Keyboard



Start by creating a new Flash movie. We'll be using Actionscript 2.0 rather than Actionscript 3.0 because of its ease of use for beginning scripters. Once we've created a movie clip in Flash, we can add scripting to it. Remember that to create a movie clip we first start by clicking the Insert menu and selecting New Symbol. Create two movie clips. The amount of animation is up to you. In this first example, we're going to add draggability to our movie clips.

After you have created the movie clips, drag them out from your library to scene1. Right click each of the clips, select Actions, and add the following script:

Mouse Control Script


view the resulting animation


Adding keyboard control to a movie clip is also fairly easy. Once again, create a new Flash Actionscript 2.0 movie. In this case we will create only one movie clip and make it move when one of the arrow keys is pressed.

After you have created your movie clip, drag it out from your library to scene1. Right click the clip, select Actions, and add the following script:

Keyboard Control Script


view the resulting animation


Sample Projects