Rocketeer Lesson 1: an Actionscript tutorial exercise using flash 8.

The purpose of this exercise is to increase my knowledge of actionscript 2.0 by rewriting the existing version of "rocketship" from scratch. At the outset, I want to acknowledge the importance of the information provided by emanuele feronato who opened my eyes to new and better ways of doing things.

I am using the graphics from the previous version, with slight modifications. If you want to follow along, download the file

lesson_1.fla (click right on thelink and select "save file").

When you open the file in your flash authoring tool you should see something similar to this:

The library contains three symbols: SHIPSHAPE contains an image of the ship without a rocket plume, and the symbol plume contains an image of the ship with a rocket plume. The symbol "rocketship" contains "plume1" which is an instance of "plume" and "hull1" which is an instance of "SHIPSHAPE." Let us now drop an instance of "rocketship" onto the main time line and give it the instance name "redship." Next, select "redship" and open the actions window. Enter the following code:

onClipEvent(load) {
	plume1._visible = false;
onClipEvent(enterFrame) {
	if (Key.isDown(Key.LEFT)) {
    if (Key.isDown(Key.RIGHT)) {
    if (Key.isDown(Key.UP)) {
        plume1._visible = true;
    if (Key.isDown(Key.DOWN)) {
        plume1._visible = false;

When you test the movie, you should be able to turn the plume on and off and rotate the rocket left and right.

We want to start in orbit about the earth, so create a clip called "PLANET" and import the following image of the earth to the stage:

Now drop PLANET into the main timeline and name the instance "earth." Add the following code to the onClipEvent(load) section of the rocketship actionscript:

	W = 1024;
	H = 768;	
	_x = (W+300)/2;
	_y = H/2; = (; = (;
Let's make the document background a deep blue and test the movie.

In the next lesson, we will implement the physics of orbital motion and maneuvering.

To start the next lesson, click here.