17 March 2008 ~ 4 Comments

flare, Flex SDK and Mac OSX

I wanted to play with flare, a flash based visualization library (also based in the prefuse visualization toolkit) I discovered in eTech. I despise Eclipse and IDEs in general so I aimed for a free, command line + Textmate based environment. This is how I got it working. Not that it’s hard, but here it is in writing to avoid common pitfalls (talk about niche posts).

Note 1: I have no experience with Actionscript, Flash or Flex.
Note 2: I’m assuming you’re on Leopard, although Tiger should work fine.

Abode provides a command line based SDK (not the commercial “Builder” product) with the flash compiler, libs and frameworkds called Flex SDK, which they opensourced recently.

First of all, the recently announced Flex 3 SDK won’t work with the current version of flare. It kept complaining about “Error: could not find source for resource bundle containers” with the flare.flex module. This is apparently a known bug but who am I to say. Also, Flex 3 had problems with the compc shell wrapper. If you really wanna give it a try, get rid of the double quotes in the last line of the script (“#$” should be just #$).

So, as we speak, use Flex 2 SDK (MTASC might work too, but I lack time so you try it Won’t work, flare requires Actionscript 3). Download the file and unzip the archive to:

/Developer/SDKs/Flex/*

Add this line to your ~/.profile file for convenience:

export FLEX_HOME=/Developer/SDKs/Flex/

Now get flare and unzip it (I used the build 20080219 and unzipped it the /servers/flare/ but any other path will work). Edit build.xml and substitute these two lines:

<property name="FLEX_HOME" value="/Developer/SDKs/Flex/"/>
<property name="asdoc" value="${FLEX_HOME}bin/asdoc"/>

Now run “ant all”. If everything goes well you should get something like this at end:

BUILD SUCCESSFUL
Total time: 21 seconds

Now TextMate. TM already has a very good ActionScript bundle. If you’re into OSX, Textmate and Flash I recommend subscribing the maintainer’s blog. So I did just two little tweaks, one to build my projects with “ant” and the other to test the .swf in Firefox. Just go the Bundle editor->Edit commands, select the ActionScript bundle, and add two commands, both under the “source.actionscript” scope:

To build: Save=All Files, Commands: ant, Input: None, Output: Show as HTML, Activation: Command-B
To test in Firefox: Save=Nothing, Commands: open -a Firefox *.html, Input: None, Output: Discard, Activation: Command-R

You don’t need to use ant to build your projects. You can do the same with a Makefile or with a plain simple shell script. I just followed flare’s example.

Now a simple project. Let’s use the example in flare’s tutorial. Here’s a tarball with the .as and build.xml ready to work with the described environment and Textmate. You’ll need a local webserver for this example to work (due to the flash security restrictions I could load the data from file://), you’ll figure it out from the source.

For debugging I had to install the Flash Player with Debug first. Then get this lib called ThunderBolt. It will enable logging through the great Firebug extension (which I’m assuming you have, otherwise you shouldn’t be reading this) with a simple Logger.error(“zbr..”);

Works. Hope this useful to someone.
  • http://www.asourceofinspiration.com/ Armando Alves

    Didn’t know you were also into Flash/flex. Get used to extreme hacking of IDEs to get the Flex SDK working.

    If you’re on Windows, you should try FlashDevelop.

  • Celso

    All I care is flare for now. So I’m learning some Actionscript 3. Luckely the sintax isn’t too different form Javascript which is nice for me.

    As I said I don’t like IDEs. And the compc compiler from Flex 2 is working now so it’s all I wan’t from it (I would have used mtasc instead but as3 and flex’s frameworks are required by flare). Windows? I don’t think so :) I’ve been spoiled a long time ago, like 20 years ago or so.

    As for editors, TextMate is just great. And it’s Actionscript bundle gives me syntax highlighting, code validation, snippets and basic integration with the authoring tools. I’m happy with it.

    Any community forums, blogs I should follow while learning to good stuf you’d suggestf?

  • http://www.asourceofinspiration.com Armando Alves

    Well a few tips:

    - Subscribe to RIApt google groups, the most active portuguese community on Flash/Flex
    - since you’re starting on AS3, kirupa.com comes in handy
    - If you’re a visual learner, head to gotoandlearn.com
    - When you’re
    - need some heavy math? flashandmath.com

    And of course, adobe.com/devnet

    Hope it helps.

  • http://tekkie.flashbit.net tekkie

    A tarball link with the .as and build.xml is broken. Directs to home page.