So you've decided to get started with 3D in Flash for the first time and don't know how to get started? This tutorial will help you set up Away3D for either Flash, Flex or Flashdevelop.
Away3D is a very capable 3D engine that is in active development, has good community support and well structured documentation that improves every day. It's a great way to get started with 3D in Flash using your favorite development tool. The process described here does not only apply to Away3D, but to any kind of source code so if you want to use MinimalComps by Keith Peters or other Open Source code, just follow the description in this tutorial.
You have two choices of getting the latest version.
Option 1: go to http://away3d.com/downloads/ and download the latest official version from there. Just download the ZIP file (away3d sources) to your computer and unpack the archive.
Option 2: set up Subversion (SVN) and get the latest version from the Google Code repository Using SVN makes it easy to always get the latest version and switch back and forth between versions available. If you use Flex, you can find a detailed description of how to use SVN in this tutorial. If you are using Flash on Windows, check out this great tutorial on SVN. Click here to read more about Subversion and why it's a great tool for developers.
To checkout Away3D using SVN, follow these steps:
When you click "Finish", Flex will create a new project and start downloading the latest version into this folder. If you at a later time want to update to the latest version, right click the project and select Team -> Update.
For Flash to find the Away3D files, you have two options.
Option 1: Store the Away3D files with the FLA
Just copy the "away3d" and "nochump" folders into the folder that your FLA file resides in. This will cause Flash to find them automatically. This has also has the benefit of making it easy to share the project. Just compress the entire folder to a ZIP archive and the recipient will have all the required code. The drawback is that if you have a lot of projects, you'll get a lot of duplicate files.
Option 2: Update Actionscript settings
Keeping the Away3D source in just one location and pointing Flash to that folder will save you a lot of duplicate files. It'll also make it easier to update to the latest version by just replacing the folder contents.
Keep in mind that if you use a direct path such as "C:\Documents and Settings\UserName\My Documents\Away3D source", the project will only work on your computer. If you use relative paths cleverly ("../Away3D source"), you can easily share the file with others that use a similar setup.
To view any of the pre-made Away3D Tutorial files, copy the class file to the same directory as the FLA. If you want to view the file "Renderers.as", copy this file as well as "Cover.as" (required). Next, type "Renderers" in the input field for "Document class" in the Properties panel and export. To view the source file itself, just click the pencil next to the "Document class" input field.
First, create a new Actionscript Project to hold your code (File -> New... -> Actionscript Project). In Flex you have the same two options as with Flash, either copy "away3d" and "nochump" folders into your project folder or link to a folder on your filesystem. If you chose the SVN option or want to link to a folder on your system, follow these steps:
To view any of the pre-made Tutorial files in Flex, copy the file you want to view (i.e. Renderers.as) as well as Cover.as (required) to your project folder. Right click "Renderers.as" in the Flex Navigator, select "Set as Default Application" and run the file.
To set up Flashdevelop for using Away3D, start by creating a new project. Select Project -> New Project. Either copy "away3d" and "nochump" folders into the project folder or link to a folder on your filesystem. To link to a folder elsewhere on your filesystem, follow these steps:
To view any of the pre-made Tutorial files in Flashdevelop, copy the file you want to view (i.e. Renderers.as) as well as Cover.as (required) to your project folder. Right click "Renderers.as" in the Project panel, check "Always compile" and Test Movie.
PS: If something is missing or does not work in this guide, email jensa at this domain and I will update the article.
Jens has been working with Flash since version 3 came out. Since then, he's been an active member of the Flash community. He's created more than a hundred Flash games (thus the name of his blog) but he also creates web/standalone applications, does workshops and other consulting. He loves playing with new technology and he is convinced that the moment you stop learning you die (creatively speaking). Jens is also the Editor of this website.