Fx2Flash Compiler Extension for Flex Builder & Eclipse
By: Michael Boucher
So I moved to a Mac when I got my new job in November working at Clearspring and I quickly started missing FlashDevelop as I chugged away in the built-in Actionscript editor in Flash CS3. I've used FlashDevelop for Actionscript coding at home on my PC and have sworn by it, so much so I actually installed Parallels on my Mac but didn't like the work flow it created. And so began my quest to find a Mac equivalent of FlashDevelop. If you are reading this looking for the same thing, let me save you the weeks of searching, it's not out there. At least not for free, but there is hope.
I've read on numerous threads about how people are using Flex Builder for their Actionscript editing and how much better it is for coding/debugging. I started to investigate how easy it was to set things up and came across Ted Patrick's post on "Using Flex Builder for Flash CS3 Coding" and Joshua Bloom's post on "Using Flex Builder to edit and debug Flash Applications." Seemed simple enough, so I recently bit the bullet and bought Flex Builder 3 and must say it was well worth the purchase. If you want to see for yourself, go download the 30-day trial and run through Mike and Joshua's posts on setting it all up. You won't go back to the built-in editor in Flash ever again, and if you do you'll miss your new little friend dearly.
So I'm off and running, I've got my code hinting for custom classes, I can CMD click on any property or method and jump straight to it's declaration and a whole slew of other nifty things that made me realize just how much time I was wasting typing out import statements and referring back to classes I had wrote months ago to remember how I implemented things. As the honeymoon phase wore off with Flex Builder – no worries we are still madly in love – I started missing a few points about FlashDevelop. I mean, here I was inside of an Adobe product but I couldn't compile my project in the Flash IDE? FlashDevelop allowed me to hit CTRL+ENTER which is an excellent feature and a huge time saver. The other thing was Task/TODO List which is an excellent little tool to have, because as we all know the small things often fall by the way side during development and having the ability to comment in a TODO or FIXME task that shows up in a console window saves a lot of "OhEss" moments come launch time.
After countless hours of searching for a solution to get Flex to compile my projects in Flash, I came up empty. So I started to think of ways I could possibly solve the problem myself. My first solution was to link to a Flash Javascrip (JSFL) file in each of my projects, simply double clicking on the JSFL executed it in Flash and ran a function to test the project, and thus compiling my Project's Flash file(s). Very crude work around and I found the CMD+TAB / CMD+ENTER was till faster. So how could I shortcut the execution of the JSFL file?
During my search for Exclipse Plug-ins and Extensions that might solve my dilemma, I found the TODO/FIXME Extension for Flex Builder 2 developed by Dirk Eismann over at richinternet.blog which works great in Flex Builder 3 as well. Currently there is only support for single line comments but it allows you to specify both TODO tasks and FIXME tasks (which get flagged hi-pri by default). You can click on the tasks to jump to their location in your code and it marks lines with TODO/FIXME comments in the sidebar of the editor. Clicking on the task markers jumps you to the item in the list. Many Kudo's to Dirk for this one and for inspiring me to develop my own Flex/Eclipse Plug-in.
And so Fx2Flash – The Flex to Flash Compiler for Flex Builder – is born. Currently in a VERY alpha stage of development I have succeeded in compiling and installing my first Java project, as well as my first Eclipse plug-in. I worked off of the files generated by the Hello World Command Template in Eclipse's Plug-in Development Environment to add a Flash Icon and Menu Item to the Eclipse interface that execute a JSFL file on my computer. Currently it is very Mac dependent, as I'm using the exec() method to run the JSFL file. However I did succeed in assinging the CMD+ENTER shortcut key so I'm very happy with where it is at so far with only about 6 hours of development time invested. Most of which was searching for Java tutorials to help lead me in the "right" direction for doing things. Unfortunately Java 6 is only available on Mac OS X 10.5 -64bit machines so I didn't have the very cool option of using AWT to by pass the OS dependent exec() command.
Next steps for Fx2Flash (which are on my TODO/FIXME List) is making it Windows/Linux compatible, as well as hopefully including the JSFL file(s) in the JAR so everything is one neat little package. Also looking into tapping into Flex Builder's Project Explorer to grab the Flash Projec (.flp) file so the correct project is compiled. Currently you have to have the Flash Project open in Flash for the compile to work. More on this in the coming week or so and I'll post the JAR for those interested in testing out and providing feedback.







Comment by Stuart — 22 August 2008 @ 2:16 pm
Sounds interesting, just the thing I’m looking for at the moment. I’ve spent all day researching how to go about editing my flash projects in FlexB 3 and I stumbled on your site. Alas, you don’t seem to have posted your JFSL online yet. I look forward to testing it when you do. Cheers
Comment by Michael Boucher — 31 August 2008 @ 1:52 pm
Hi Stuart,
Unfortunately got a bit sidetracked and left it at “it works” on my machine. I think I’m going to package and see if anybody else can solve some of the issues. One such issue is including the JSFL file in the plug-in jar file so everything is one neat little package. I’ll probably package the files and post for other to use shortly along with some step-by-step on things I’ve done to improve Flex->Flash workflow.
Thanks for visiting my site. I want to jump on a couple of other FB plug-in projects I’ve come up with as well to help improve things. Once such is an ASDoc viewer that will allow the viewer of an AS file to see the ASDoc comments formatted out for them. On our team we are always jumping in each other’s code and it would be nice to just have the docs right there for everybody to see in FB.
Enough for now.
Take care and I’ll let you know when I post the examples. Hoping to find some time this weekend.
-michael
Pingback by Adobe Flash CS4 Project Panel: Bitter Sweet | We Are Studio — 21 October 2008 @ 12:02 am
[…] support, which brings a tear to my eye. For me personally this means the Eclipse Plug-in I wrote, Fx2Flash, that allows me to compile my projects in the Flash IDE, directly from Flex Builder, no longer […]
Comment by cycle — 21 October 2008 @ 10:46 am
I’m currently looking into using this Flex builder 3 integration with Flash as I’m about to start migrating a massive AS2 project to AS3. The code hinting features will be nice but what I’d really like to do is to be able to set breakpoints in the AS3 and debug my Flash app that way, inspecting variable values (I also use Visual Studio and just love those features). Is this possible when using the method you mention?
Thanks in anticipation.