PASZ.COM ARTICLES

Getting Started With MTASC for Flash Development

I. INSTALL THE NECESSARY SOFTWARE

1. Make sure you have the latest version of the JDK installed! (J2SE 5.0 as of this writing.)
http://java.sun.com/j2se/index.jsp
For this tutorial, you'll also need Flash 8.

2. Download the latest version of Eclipse.

3. Unzip Eclipse. I recommend putting it a the root level of your drive (i.e.: C:\Eclipse). When it's done, you might also make a shortcut to the "eclipse.exe" file for you Start Menu or Desktop.

4. Downlaod MTASC, ASDT and Flashout . Put the zip files into your Eclipse directory.

5. Unzip each one using the "Extract Here" option of your unzipping program. (Note that most of the files you unzip will get copied into your Eclipes/plugins folder.) After deleting the Zips, your Eclipse directory should look something like this:

II. CONFIGURE ECLIPSE

1. Launch Eclipse. A dialog will prompt you to supply your Workspace. Choose a directory where you plan to keep your Projects.

2. If the Welcome screen comes up, just close it. It won't help you for Flash stuff anyway. Now you should see an empty IDE, with the Package Explorer window on the left side.

3. Open the Window/Preferences. Select ActionScript2/MTASC from the hierarchical list on the left. Configure as shown in the following shot. You need to point to the mtasc.exe you installed.

4. Still in the Preferences dialog, configure the ActionScript2/Pathes (sic) setting. All you have to do here is point to the Macromedia core classes (i.e. your MTASC/std directory).

5. Configure your Flashout preferences. Again, you need to point to MTASC.exe and the Macromedia core classes. When you're done, you can close the Preferences dialog.

6. Select Window/Customize Prespective... In the dialog, make sure "ActionScript" is checked in the New submenu on the left. Confirm that the "New ActionScript Class" and "New ActionScript Project" shortcuts on the right are also checked. Click "OK" when you're done.

III. CREATE A PROJECT

1. Select File/New/ActionScript2 Project. Name your project, and click "Finish". Your Project should appear in the Package Explorer. In this example, the Project will be called "Test".

2. Create folder for your classes by selecting File/New/Folder. In this example, I will call it "src".

3. In the Package Explorer, right-click on your Project and select "Properties". Select ActionScript2 Project in the menu on the left. Type "src" into the classpath field, then click "Add". Click "OK" to close the Project Properties dialog.

4. Create a new class that will be the entry point for you application by right-clicking on the "src" folder in the Package Explorer, and selecting New/ActionScript2 class. Name the class "Test", and click "Finish". (You can leave the Package field empty.) A "Test.as" file will be created, and it will open up automatically for editing.

5. In Test.as, insert the following code into the class that was pre-generated (between the curly braces), and save the file:

function Test(scope:MovieClip) {
//local function: drawPoint
  var drawPoint = function(p:flash.geom.Point, size:Number, tgt:MovieClip, color: Number){
    if (!color) color = 0x000000; //black
     tgt.lineStyle(size, color);
     tgt.moveTo(p.x-1, p.y);
     tgt.lineTo(p.x+1, p.y);
     tgt.moveTo(p.x, p.y-1);
     tgt.lineTo(p.x, p.y+1);
   }

//Draw a diagonal line of Points 10 pixels apart
   for(var i = 10; i < 200; i += 10){
     var myPoint = new flash.geom.Point(i,i);
     drawPoint(myPoint, 5, scope);
   }
}

//Main Entry Point
static function main() {
  var test:Test = new Test(_root);
}

6. In the Package Explorer, right-click on the "test" project and select New/File. Name the file "test.flashout". Your IDE should now look like this:

7. Double-click the test.flashout file that was created. The Flashout UI can be a bit confusing to work with at first, but don't be daunted -- the worst is over. Select the "Compilation status/preferences" tab near the bottom of the flashout window. Then, select the "SWF" at the top. (These tabs were probably already pre-selected.)

8. Enter the path where you want to publish your SWF (note that the file does not exist yet). Also enter the path to your entry point file ("test.as").

9. Click the "Additionals" tab at the top and enter the following in the field that says "additional params for compilation: -header 640:480:24. This will specify the width, height and FPS of your SWF. Since we will be using Flash 8 for this example, be sure to pass in a -version 8 parameter as well.

10. Click "Compile" and watch your SWF get created. Congratulations!

IV. Next Steps

Hopefully this article was enough for you to get started with FAME, and try out a few experiments. But becoming a full-fledged FAME developer is going to take a bit more effort. Here are some suggestions about what to do next.

  • Read Bit-101's summary of the various tools in the FAME arsenal. This should give you a better idea of strengths and weaknesses of the various tools you installed in this tutorial.
  • Work through my follow-up Tutorial, Getting More Out Of FAME, which builds on what you learned here. It covers debugging, working with art assets, and setting up a class library.
  • Get the Delegate Class from Dynamic Flash, and include it in your MTASC std directory. You're going to need this in order to implement event handling properly. (You can use my gradient wheel demo as an example of how to use the Delegate class to set up an event handler.)
  • Learn about the new API, and start having fun with Flash 8!
  • Keep up with the latest developments in the Open Source Flash Community at OSFlash.
  • Check back regularly at PASZ.COM for more FAME tips, examples and tutorials.

Please post comments, questions and corrections to this article here.


Article Index