Tutorial: FlashDevelop + ANT + Apollo Template
This tutorial goes hand in hand with the Apollo template for FlashDevelop that I posted a few days ago.
What you will need to get setup:
Ok, first things first - make sure you have downloaded each of the above and extracted their files into the directories of your liking.
For ANT, you will need to add a path to your environment variables so that it can be accessed without writing out the path in the commandline. To do this, you will need to right click on 'My Computer' and select 'Properties'. Click the 'Advanced' tab at the top, then click the 'Environment Variables' button at the bottom of the window. In the bottom panel, there should be a variable called 'Path'. Select it and click the 'Edit' button. Add the path to the directory where you installed ANT plus '\bin'. If you added it to the end of the text field, make sure and add a semi-colon to the end of the previous path. This is similar to what you should see:

Next, you will need to create a way to run your ANT build from FlashDevelop. Inside the FlashDevelop application folder, there is a folder called 'Settings'. Inside the 'Settings' folder you will find all of the XML files for customizing FlashDevelop. To add a button to the tool bar for ANT, open the 'ToolBar.xml' file. Here is what your new button node should look like:
-
<button label="ANT Build" click="PluginCommand" image="54" tag="Run;SaveAll;ant" shortcut="CtrlF7" />
Note that you can set any shortcut you please for this action, however you should check the program settings to make sure that you aren't overwritting one that already exists. You can always change the FlashDevelop shortcuts around as you see fit.
Ok, your ANT integration with FlashDevelop is ready to go. Now you need to open up the 'build.properties' file that is located in my Apollo template. Towards the bottom of the file, you will see some settings for the Flex 2 SDK and Apollo SDK install paths that look like these:
-
flex2.dir=C:/Program Files/Adobe/Flex_2_SDK
-
apollo.dir=C:/Program Files/Adobe/Apollo
Go ahead and update these paths with the paths that you actually used for these applications. That's basically it! Now each time you create a new project, the first thing you should do is go into the 'build.properties' file for that project and update the settings at the top for the AIR file name, documentation name, output file, etc.
Also note that it is in this file that you can toggle the launch method to either test or publish your AIR file as seen below.
-
# Values are 'test' or 'air'.
-
# test - Launches your Apollo app without packaging an AIR file.
-
# air - Publishes your Apollo app as an AIR file and generates documentation.
-
launchmethod=test
What actually happens now when you click the ANT button you added (or use it's associated shortcut key) is ANT gets called and uses the 'build.xml' file in the project directory to perform a sequence of tasks for you, thus automating your build process. To be able to click a button and get your project compiled to a SWF, packaged as an AIR file, then documentation generated for all of your source is a beautiful thing; that is why the template is so useful.
Hopefully I didn't miss anything. If you have any questions, post away.
20 Comments so far
Leave a reply

[...] [Update March 28, 2007] I posted a tutorial to go along with this template that explains the setup of FlashDevelop and ANT, as well as configuring this template. [/Update] [...]
[...] Apollo mit FlashDevelop….KEIN PROBLEM mehr boostworthyisryantaylor » Tutorial: FlashDevelop + ANT + Apollo Template [...]
Thank you for this nice template for use in Flash Develop. How can we use mxml to build an Apollo application with this set up ? as we do in Flex Builder. I am not good in setting these kind of stuff :- thank you ...
In the project's 'build.properties' file, simply change the 'source.file' property to point towards your application's mxml file.
Hey there, I'm new to flex flashdevelop and apollo.
I Managed to get it working, and succesfully managed to do a 'hello world' with App.as, great!
I then tried to move to using mxml and I'm getting the following errors in the output panel:
Error: null
java.lang.NullPointerException
at macromedia.asc.semantics.InterfaceWalker.processQueue(InterfaceWalker.java:75)
at macromedia.asc.semantics.InterfaceWalker.(InterfaceWalker.java:27)
at macromedia.asc.semantics.InterfaceWalker.(InterfaceWalker.java:17)
at macromedia.asc.semantics.FlowAnalyzer.scanInterfaceMethods(FlowAnalyzer.java:5997)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:4858)
at macromedia.asc.parser.BinaryClassDefNode.evaluate(BinaryClassDefNode.java:22)
at macromedia.asc.semantics.FlowAnalyzer.evaluate(FlowAnalyzer.java:2577)
at macromedia.asc.parser.ProgramNode.evaluate(ProgramNode.java:63)
at flex2.compiler.abc.Compiler.analyze2(Compiler.java:299)
at flex2.compiler.API.analyze(API.java:2360)
at flex2.compiler.API.analyze(API.java:2275)
Result: 1
at flex2.compiler.API.batch2(API.java:337)
at flex2.compiler.API.batch(API.java:1025)
at flex2.compiler.API.compile(API.java:1211)
at flex2.compiler.API.compile(API.java:1114)
at flex2.tools.Compiler.main(Compiler.java:222)
using the mxml:
Application
{
background-image:"";
background-color:"";
background-alpha:"0.5";
}
Am I missing something obvious?
mxml didn't come out properly in the comments, it's the code detailed here:
http://labs.adobe.com/wiki/index.php/Apollo:Documentation:Create_your_first_Flex-based_Apollo_application_using_the_Apollo_SDK
Try adding this argument for the compiler in the 'build.xml' file:
Thanks, that did something... I now get the following errors:
src\apollo\classes\mx\core\ApolloApplication.as
(421): col: 48 Error: The definition of base class Application was not found.
(764): col: 34 Error: Method marked override must override another method.
(841): col: 35 Error: Method marked override must override another method.
(930): col: 35 Error: Method marked override must override another method.
(1140): col: 33 Error: Method marked override must override another method.
(1192): col: 33 Error: Method marked override must override another method.
(1225): col: 33 Error: Method marked override must override another method.
(1241): col: 33 Error: Method marked override must override another method.
src\apollo\classes\mx\core\Version.as
(16): col: 1 Error: Namespace was not found or is not a compile-time constant.
Ok, I figured out what the deal is. The Apollo framework extends upon the Flex framework and I don't have a source path pointing to that in the template build file. I'm going to post an updated version that is both Flash and Flex friendly today. Thanks for bringing this stuff to my attention, I really appreciate it.
Hey there, just got around to testing your new template (over a month later - my flex builder trial expired!) and I'm coming up with some new errors!
Error: Unable to resolve a class for ResourceBundle: core.
Error: Unable to resolve a class for ResourceBundle: core.
Error: Unable to resolve a class for ResourceBundle: core.
Error: Unable to resolve a class for ResourceBundle: core.
Error: Unable to resolve a class for ResourceBundle: styles.
Error: Unable to resolve a class for ResourceBundle: core.
Error: Unable to resolve a class for ResourceBundle: effects.
Error: Unable to resolve a class for ResourceBundle: skins.
I'm using the same code as before, do these mean anything to you?
Thanks for reviewing the last lot by the way
Can you confirm that you configured the 'build.properties' file to correctly point towards all the necessary install paths on your machine? It sounds like it's having an issue finding either the library of SWC files for Apollo or maybe even Flex.
Confirmed. I have them installed to your default paths.
As before, it works fine compling the App.as, it only has this problem when trying the 'hello Apollo' mxml.
same here - App.as works like a charm, with the app.mxml file i am getting the same error as Thomas. any solution? thanks!
Sorry guys, I have been slammed with various work and haven't had a chance to investigate the mxml issue. I will look into it and post up my findings as soon as I get some spare time.
I've finally been able to compile a mxml file.
1) the templates doesn't works with FD v3Beta (because RunCommand plugin doesn't works), so I created a .bat file to execute ant:
%ANT_HOME%\bin\ant -buildfile "%CD%\build.xml" -logfile here.txt -verbose
2) I removed all other source paths leaving only what was needed. There was a conflict among all of them:
And that's it! I changed the source.file, output.file and the reference in application.xml
Thanks for the template!!
I got the same "Unable to resolve" error and made the following additions:
To the build.properties I added:
flexlib.dir=frameworks/libs
flexlocale.dir=frameworks/locale/en_US
You'll need to change "en_US" if you have a different locale.
To the build.xml I added these under the current -library-path call:
That did it.
Thanks a ton for the template, Ryan.
Ack, looks like it removed my additions to the build.xml - I wasn't thinking about the tags. Ok, let me try this again:
<arg line="-library-path
'${flex2.dir}/${flexlib.dir}'" />
<arg line="-library-path
'${flex2.dir}/${flexlocale.dir}'" />
Great, thanks for looking into that issue guys. I apologize for not getting around to it myself; I have been quite busy lately.
Yeah, that did it indeed. Thanks a lot Gordon and Ryan!
Horray
Got it working, thanks guys