The Fnk development processBy zeh • Aug 16th, 2008 • Category: Developer diaries
Together with writing the project thesis, the most important part on the Fnk project is doing the actual working software, that is, building the environment that I’m proposing on my thesis itself. How I do it is something I’ve wanted to talk about here for a while, and since I’m spending part of this day doing some changes to my development workflow, I figured I’d go ahead and write a bit about it.
First, the obvious: Fnk is built with Adobe Flash technology, using the Actionscript language (version 3), as it’s meant to be an environment that can be ran on all kinds of computers, both from the user’s browser and as an application. When people think of Flash (or Actionscript), however, most think of Adobe’s proprietary Flash content IDE (nowadays called Flash CS3), and use it as an excuse to explain why the technology isn’t mature enough – it’s not “open”, it’s done for designers, it’s not available on Linux, its coding editing capabilities suck, and so on and so forth. Developers will also complain about how the “.FLA” format is not open (or at least not as open as the .SWF specifications), so developers are tied to the IDE currently available.
While all of these points are true, what many people don’t know or don’t realize is that Actionscript developers are not really restricted to Flash CS3, or commercial tools for that matter, and that .FLA files are irrelevant. And that is, actually, is the gist of this post.
First of all, as a framework for software development, the Flash Platform employs a real compiler that works very much like the compiler you’d find available for other languages – including working as a command line application. That compiler is called the Flex SDK, and is not only free, but open-source and available for all three major operational system platforms.
Second, while compilation is pretty easy as mentioned, editing is another question entirely. Without Flash CS3, how are developers supposed to create their Flash movies?
The answer to this question is a bit longer. Before anything, it’s important to notice that since the Flex SDK compiler take cares of creating the SWF for you – including embedding assets such as graphics, fonts and other kind of data – you can potentially use anything to develop Flash content, even Notepad. This means the question is not whether something can edit Flash projects – any text editor can – but rather how well can it help you create and maintain a Flash project.
Fortunately, there are tools better fit for the job than Notepad. These include commercial tools; with Adobe, other than Flash CS3 itself, there’s Flex Builder – which is a “programmer” IDE built on top of Eclipse – and there’s also FDT 3, which is another Flash-focused IDE built as an Eclipse plugin. There’s a also a number of wonderful free editors available, most notably FlashDevelop. The advantage of these editors is offering features for easier editing and debugging such as code completion, automatic importing, syntax highlighting and hinting, project management, and so on.
Back to the topic, what am I using for Fnk?
First of all, no, I’m not using Flash CS3. While I still do use it (in all real-world projects, in fact) I’d only use it to edit graphics assets and set their position on the movie. Since I wasn’t going to do that with Fnk – all graphics assets used (the application skin) would be dynamically applied – I didn’t need any of that content, so it could be fully edited on an external application.
At first, when I started the project late last year, I was using FlashDevelop for it, since it has been my environment of choice for any kind of Actionscript-related development for a while (if it isn’t obvious enough yet: even when I do all my work in Flash CS3, I use external editors to edit the code). So I’d edit all of my code in FlashDevelop, then quickly switch to the command line (yes, I’m oldschool like that) and run some Ant task that would take care of compiling and running my test application.
That worked pretty well. However, thanks to the influence from Francis Turmel from Firstborn, I decided to give FDT a test and installed a trial version of the software.
I was really, really overwhelmed at first. Since I had never used Eclipse before, the sheer amount of preferences and features available was enough to make me feel pretty dumb. I’m sure that for a seasoned Eclipse developer, FDT is pure bliss, but for me it was feeling more like a sort of a personal Java-based hell.
This didn’t last too long, though. Thanks to many resources available online, as well as some friend which I’m sure enjoyed my pestering immensely, I was able to quickly learn how to use that IDE for the basic tasks of Actionscript editing and, from that, start using some of the more advanced features FDT has to easen development (too many to list here).
This also represented a decision on the way I wanted the Fnk project to develop. At first, I was interested in using only free software on it, as a sort of a proof of concept for Flash development – showing it’s possible to develop a mature project with free tools and stuff like that. However, while FlashDevelop is a very powerful tool and while it would be perfectly possible to develop this project using it, I was also starting to use FDT for some real-life work and didn’t want to keep switching between two different code editing environments depending on the project. The final decision was that FDT was good enough and I was sticking to it – even oppressed by the avalanche of options, I was more productive with it than without it. Even with its premium price tag, I do think the program is worth the money they charge for it, although I must confess I’ve been lucky in that regard – once the FDT trial has ended, I applied and got a free Open Source license that granted me a full license of FDT, sans tech support, for free (thanks, Simon Elschenbroich and FDT team!).
Developing with FDT (as is the case with FlashDevelop honestly) is fairly easy – write your code, manage your project, then compile using whatever tasks you’ve setup to do so by typing whatever keystroke you’ve selected to do so. On Fnk’s case, pressing the typical CTRL+ENTER compiles the project and opens Fnk on a new application window (pictured above). This means you can develop Flash content like you would do with any other application programming language, like Java, C#, VB and so on (yes, I know this is obvious to Flash developers, but a lot of people still fail to understand that).
All compilation is done by Flex SDK and handled by Ant tasks. This brings me to those mentioned “changes” to the Fnk project that motivated this post: the fact that, while the currently available version of the Flash Platform is version 9, I’m compiling Fnk to Flash 10 already.
Explaining is easy: one of the advantages of Flash development is that, since the compiling tools are made available a long time before the updated editors (like the next version of Flash) are distributed, anyone can test new versions of the technology whenever he or she desires. All that is needed is an update version of the compiler, and the player API definition (a .swc file – think of it as the signature of the internally available Flash Player classes). Fortunately, both are publicly available online, and can be found here.
I’ve actually been targetting Flash 10 for a while, but not using any of the new features, as the IDE themselves are still lacking access to some features introduced by the newest version of the platform. What I did today, however, was do a full update of my project settings as well as the FDT environment (since there are now beta versions of FDT available which are more on sync with the new features) to allow me to fully exploit the new features even before new official editors are available. The practical result is that it’s working pretty flawlessly, and thanks to the API definition file, even code autocompletion works perfectly despite being part of some undocumented, unreleased version of the platform.
As a sort of a side note, I’ve been in a sort of an IDE limbo for the past couple of years, never being fully happy with any of the environments I’ve setup for myself and for my highly visual Flash development. But, in the past few months, I’ve grown really confortable with FDT, even though I’m pretty sure I’m still using just a small subset of the features it has; if anything, the only negative I saw in this adaptation process was the steep learning curve of the Eclipse IDE.
I think, however, that this will sort itself out in the future: there are projects like FDTKit (from which I’ve based part of my Flash project structure and most of my ant tasks) which aim to make development easier, and the FDT project itself has now a standalone version (which I still have to test, but that sounds awesome).
All in all, I guess no one has the excuse that there are no good IDEs for serious Actionscript development (specially complex applications) anymore. FDT, FlashDevelop and others have been around for a while to prove otherwise, and are only getting better.