Package your code with ant

April 23rd, 2008

I recently commented on how ant is by far the most versatile and flexible way to compile your Flex applications, take for example this sample swc compiler project.

I keep this project handy in my workspace, and if I ever need to compile or package my source code into a swc file (pronounced swik for the noobs) I do the following:

  1. Copy my source code into the source directory
  2. Open up build.properties and set the parameters
    flex-sdk-dir=C:/tools/flex3_sdk
    output-name=pixelate.swc
    src-dir=src
    bin-dir=bin
  3. And open up build.xml in the Eclipse Ant view
  4. Now I am good to go
  5. Finally to build my project simply double click the “compile-swc” task in my Ant view.

This is obviously a very basic example, but consider how useful this becomes if you are developing a third-party api for a team of developers.

You can distribute your code in a neat tidy package and be safe in the knowledge that if anyone decides tinker with your code they only have access to available public members.

Don’t even consider compiling a swc file and expecting it to be completely secure and inaccessible, because where there’s a will there is a way. The point is that you have a working tool that you can distribute and safe guard yourself against bugs caused by other developers.

Download the above mentioned swccompiler.

And old pixelate effect

April 17th, 2008

Been sweeping my desktop and came across an old pixelate effect, so I have decided to share.

Upgrade your flash player if you see this message

Extended Flex ComboBox

April 16th, 2008

DEfusion posted an extended Flex ComboBox that works a treat check it out: FoxyComboBox

Bumped into this via this, and thought I would share. The more flex I code the happier I get, is that normal?

Flex = Dopamine = sm:)e

Cairngorm event gotcha

April 15th, 2008

The latest version of Cairngorm i.e. Cairngorm v2.2.1 has an added helper method in the CairngormEvent class. CairngormEvent->dispatch(e:CairngormEvent). The other day I was busy debugging an application and came across the following code inside one of the views:

var event:CairngormEvent = new CairngormEvent();
dispatchEvent(event);

At first glance this seems completely normal but will fail silently and cease to trigger the associated command.

While I do appreciate the new CairngormEvent helper method which should look like this:

var event:CairngormEvent = new CairngormEvent();
event.dispatch();

for clarity towards fellow team members who may not be familiar with Cairngorm and better distinction between Cairngorm application events and standard view events, I recommend still using the original syntax to dispatch your events:

var event:CairngormEvent = new CairngormEvent();
CairngormEventDispatcher.getInstance().dispatchEvent(event);

This will ensure that the event is clearly dispatched by the Cairngorm framework and not your view.