Flash Develop AS3 Project Template

If you want to start playing with AS3 using the free Flex 2 SDK, and are using FlashDevelop, I created a project template that you can use to set up a new AS3 project automatically. Files are here:

http://www.bit-101.com/misc/AS3Project.zip

Just unzip that into your templates directory, which is usually something like:

C:\Program Files\FlashDevelop\Data\ProjectTemplates

Then you’ll want to go in and edit the build.xml file in that directory. It contains paths to mxmlc.exe and FlashDevelop.exe. Make sure they are set to where your apps actually reside.

Now, this whole thing depends on Apache Ant, so you’ll have to set that up. Here’s something I wrote up a while ago if you need to install Ant:

http://www.bit-101.com/blog/?p=627

After you’ve got all that done, restart FlashDevelop and create a new project. Choose AS3 Project and choose a directory. It should create a default .as file, a build.xml file and a deploy directory. Edit the .as file and run Ant in your project directory. Now, that might be the tough part, but I’ve thought of that too. Open up your toolbar.xml file which is in something like:

C:\Program Files\FlashDevelop\Settings

and add this line to the bottom:

< button label=”Ant Build” click=”RunProcessCaptured” image=”54″ tag=”C:\WINDOWS\SYSTEM32\CMD.EXE;/k ant” shortcut=”F7″ />

You’ll want to set your own shortcut key, as F7 will conflict with “Check ActionScript” in the default configuration. Anyway, restart FD, edit your file, hit that new button, or hit your shortcut key, and Ant should run, compile your file, and launch the swf right in a new tab in the interface.

Note, FD does not support code completion, hinting, highlighting, etc. for AS3 yet. So you are on your own for most of that. But I think that’s being worked on. Anyway, this’ll make it a bit easier for you to get started, hopefully. Also, FD will not save your “dirty” files when you hit the button or shortcut.

Credit to Sam Robbins for the original version of the build.xml file.

 

[edit]

Unfortunately, I’ve just found out that this only works if the currently open file is in the same directory as the build.xml file. Otherwise, it runs Ant from the directory of the open file, and it is unable to find build.xml. Looking for a solution now. If anyone knows one, let me know.

This entry was posted in General. Bookmark the permalink.

3 Responses to Flash Develop AS3 Project Template

  1. Tangent says:

    I have created a plug-in (FlashBuild) for FlashDevelop which allows Flex2 compilation at:

    http://www.flashdevelop.org/community/viewtopic.php?t=287

    Phil just helped me create a survey on features rounding up this version of FlashBuild. Since I haven’t started using Flex2 much, your insides and feedbacks may help a lot creating something more convenient and productive:

    http://www.flashdevelop.org/community/viewtopic.php?t=710

  2. kp says:

    I took a look at FlashBuild. I just thought it would be easier to use Ant, a language I already know, than to use a new format for creating build files. But unless this directory problem gets resolved quickly, I’ll probably give it another go.

  3. Tangent says:

    FlashBuild would run build from the context of the project directory. I am working on a GUI version FlashBuild which would make the XML construction easier.

Leave a Reply