Creating the Drag screen

Now the only missing element is that we don't yet have a Drag screen. By now I'm sure you know what's coming next. Let's copy the background out of the Intro symbol again, and use it to make a new symbol. Double click the Intro symbol in the library, unlock the background layer, and copy the first frame of that layer by right-clicking it again and choosing "Copy Frames." Next, from the Insert menu, choose "New Symbol..." Type in "Drag," make sure it's type is set to MovieClip, check "export for actionscript, accept the name "Drag" for a class name, and click OK, and then OK again. Once in edit mode, right click the first frame on the timeline and choose "Paste Frames." Next, go back to Scene1. This will be enough of a dummy screen to test our movie.

Open Template.as. Change the word Intro to Drag in two places, then save the file as Drag.as. Now the drag symbol in the library has this class linked to it, just like the others previously.

Go back to Main.as again. We need to write the code that declares the variable for the drag screen. Add this code to the variables list:

private var drag:Drag;

And then in the constructor, we need to create a new instance of the drag screen. So type this at the end of the constructor function:

 
drag = new Drag();

Save the file. Here's the latest version of Main.as:

package {
	import flash.display.*;
	import flash.events.*;
	
	public class Main extends MovieClip {
		private var intro:Intro;
		private var learn:Learn;
		private var drag:Drag;
		private var currentScreen:MovieClip;
		
		public function Main() {
			intro = new Intro();
			addChild(intro);
			currentScreen = intro;
			learn = new Learn();
			drag = new Drag();
		}
		public function gotoLearn():void {
			removeChild(currentScreen);
			addChild(learn);
			currentScreen = learn;
		}
		public function gotoDrag():void {
			removeChild(currentScreen);
			addChild(drag);
			currentScreen = drag;
		}
	}
}

Now you can test the movie. You will be able to navigate to the learn screen, then to the drag screen. You won't be able to navigate any further though, until we further develop both the Drag screen and the Drag.as class file, which we will do on the next page.