BIT-101 [2003-2017]

New FlashDevelop Project Templates


OK, if you want to work in AS3 or Flex2 with FlashDevelop, I think I’ve made it about as easy as it can possibly be until we get a new version of the program that has all this built in.

I created two new Ant-based templates. These include a fairly complex build.xml file, and a very simple and easy to read build.properties file. For the most part, you should never have to touch the build.xml, just change your values in the build.properties, which looks like this:

######################################
## project properties
######################################

source.file=App.as
output.file=App.swf

deploy.dir=deploy
source.dir=src

# values are tab, standalone, or html
launchmethod=html

######################################
## output swf properties
######################################

# note: no # or 0x on color value!
background.color=ffffff
framerate=31
width=550
height=400

######################################
## tools
######################################

# where you installed flex:
flex2.dir=C:/Flex_2_sdk

# works well with firefox. IE needs some work.
browser=C:/Program Files/Mozilla Firefox/firefox.exe

# most of this shouldn’t need to change
compiler=bin/mxmlc.exe
saplayer=player/debug/SAFlashPlayer.exe
flashdevelop=C:/Program Files/FlashDevelop/FlashDevelop.exe

As you can see, you set your input and output files and directories, and choose a launch method, which can be “tab” (launch swf in FlashDevelop), “standalone” (launch swf in standalone player), or “html” (launch your browser with the html file created for your swf – more on that in a moment).

Then you set your output swf properties, such as background color, frame rate, width and height.

Finally, tell it where your programs are: your Flex 2 install directory, browser, and FlashDevelop.exe are the important ones.

Then just open the supplied base source file, add your own code, additional files, etc. and compile using Ant (more on that in a minute, too).

HTML Template.

The project comes with a swfobject based html template. For now, I’ve included the swfobject.js file right in the templates, but I’m checking on whether or not it’s cool to distribute it like that. Compiling your project will also create a custom html file based on the template, and put that in the deploy directory. This is what it launches if  you choose “html” as a launch method.

Installation.

  1. Install the Flex 2 sdk. This is kind of a given, but I’ll mention it.

  2. Download the templates and unzip them into your projects template directory in FlashDevelop. (I’m sure you can find it if you dig around.)

  3. Install Ant if you haven’t already. Here’s some data on that if you need it.

  4. Install the RunCommand plugin, which you can find here:

https://www.flashdevelop.org/community/viewtopic.php?p=3496

One thing I didn’t realize about this at first is that when using this plugin, FlashDevelop automatically changes the directory to the project dir. So no more hacks needed for that!

  1. Add the following line to your ToolBar.xml file in the FlashDevelop installation folder (you can find that too). You’ll probably want to choose your own shortcut key, as I’ve messed with mine a bit, and F7 does something else by default.

< button label=“ANT Build” click=“PluginCommand” image=“54” tag=“Run;SaveAll;ant” shortcut=“F7” />

  1. Restart FlashDevelop, create a new project, choose one of the new ones, tweak your build.properties, add some code, hit F7 (or whatever) or the new button on the toolbar, and behold the Flash 9 goodness!
« Previous Post
Next Post »