Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post Build Actions in Flex Builder

How do I add post-build actions in Flex Builder? For example, I'd like my build to work as normal, and execute from the bin folder; but I'd also like a copy of the final SWF to be copied to another folder automatically (I'm sick of doing it myself).

Thanks!

like image 629
Steve Middleton Avatar asked Aug 14 '09 16:08

Steve Middleton


3 Answers

I know this post has been answered, but I found something simpler. I'm sure the Ant solutions are the way to go, but I didn't feel like messing with ant for my small project. All I really want is to have my html files and swf files in different directories. I guess that's a lot to ask.

I'm building on windows, so I created a simple batch file that performs my post-build steps (namely some move commands). I then created a new builder in flex using windows cmd.exe. I just told it to call the batch file using the /C option. It works perfectly and was very simple to set up. I tried adding screen shots, but I guess I'm too new to the site.

like image 146
user576154 Avatar answered Oct 17 '22 03:10

user576154


You can extend or replace the builder used by Flex Builder 3 with extenal programs - ant is a good choice.

If you run "Flex Builder 3 standalone" (which is a minimalist Eclipse version + the Flex builder plugin) as opposed to the Flex builder plugin in a standard Eclipse, you first need to install ant support. I didn't find ant separately packaged, so I just selected the Java build environment from Help / Software Updates.

Now you can go to your project properties (Right-Click on your Project, Properties) and chose Builders. You'll notice there is a Flex Builder per default, which you cannot remove nor change. However, you can deselect it and you can add other builders.

So in your case: "add" a new builder, ant builder, select a build.xml (can be named differently), preferably from within your project folder, and set the correct targets. This will continue to use the internal IDE builder while running your ant task just before or afterwards. The ordering on the screen will be the build order, which you can change using the arrow buttons.

I used this to copy required libraries into my /lib folder, compile the Flex sources using the IDE build (which has Eclipse-integration with error messages, which a pure ant-based commandline build would miss), and copy the result to a common deploy directory, renaming the wrapper html file in this process.

For details of how to write an ant file, please refer to the ant documentation.

like image 32
Zefiro Avatar answered Oct 17 '22 03:10

Zefiro


I would also recommend using ant.

I posted a big article on how to get it set up for flexbuilder here http://dispatchevent.org/mims/ant-for-flex-part-1/ I think there is even an example in my build script of copying files from one place to another after compiling.

Good luck!

like image 1
Mims H. Wright Avatar answered Oct 17 '22 04:10

Mims H. Wright