Adobe Flex isn’t Flash

May 14th, 2008

But it is pretty cool.

Adobe will tell you that Flex is Flash. And the file extention is swf, so really it is Flash. But.. it is far closer to HTML and Javascript than to the movie clips and timelines of Flash. I’ve done a bit of Flash, and now a bit of Flex, and developing the two seems worlds apart.

Extensive knowledge of HTML, CSS, Javascript and all of the various browser handling tricks will let you begin creating a modern RIA (Rich Internet Application). But now the much simpler option is to just do it in Flex.

No need for AJAX calls, just use the very neat HTTPService object. No worries positioning your screen items, just drag and drop them. Nothing to do to handle different browsers, as a Flash file is going to look identical on any browser.

And it certainly helps that the available controls look very nice. And some very advanced controls they are, also. The default data grid’s standard abilities would take a huge amount of difficult to manage Javascript to duplicate (resizable columns, automatic sorting by column, click a value and it changes to an edit field, highlighting on mouseover, highlighting of selected row, etc.).

I’m not exactly sure how Adobe makes money out of this kind of thing. It all seems free, although I believe the original Flex did have some big licencing costs. I plan on taking advantage of Flex whereever possible from now on, so I’m hoping it stays free and it continues to be supported.

And how about Adobe AIR.. Well, there’s a whole new interesting approach that is really a very short hop from Flex.

Flex product page :
Coding examples :
RIA examples :
Language reference :
Design :


April 5th, 2008

Google will tell you what one is.

In my words - it is a cute little box that acts just like a little digital photo frame. But this photo frame has a brain, and wifi..

It can show you the latest news reports, or the weather, or the time, or a webcam, or stream music from the web, etc. And you can touch the screen, and make it do stuff. Like play a game of chess. And you can pick it up and shake it, and tilt it, and the screen will respond. Cool, eh?

So you set it up, put it somewhere, and glance at it every now and then. Just like a photo frame, but with much more interesting and relevant information.

Whilst this is cool, it is not why I bought one. I bought one because I can code stuff for it. Now it is very cool.

So buy one. If you are in Australia, like me, then try (they are only sold in the USA currently).

Line Rider

March 7th, 2008

Line rider is a very cool flash program that animates a tobogganist sliding along a user created path. There are some amazing paths people have created, just check out YouTube. Anyway, I am currently writing something similar as it is an interesting physics/mathematics challenge.

One problem that came up was rotating objects in Flash. Flash lets you set the angle of rotation, but does not offer a nice way to define the point to rotate around (the pivot point). By default, this is the top left corner of an object. After a fair bit of googling, I found a fancy prototype class that could do it. In the aim of helping others, I thought I’d post my generic function based on the method used in that class. My function is not as fancy, but much easier to use. Note that this does not actually change the pivot point, it just does the rotate based on 0,0 and then moves the object to the correct location to generate the correct rotation position.

The function should be self explainatory. Pass the object(ie. movie clip) as o, px & py are the co-ordinates of the intended pivot point (0,0 would be the top left of the object), r is the angle to rotate by (10 would be ten degrees clockwise).

function rotate(o:Object, px:Number, py:Number, r:Number) {
var a = {x:px, y:py};
var b = {x:px, y:py};
o.localToGlobal (b);
o._parent.globalToLocal (b);
o._x -= b.x - a.x;
o._y -= b.y - a.y;

Cowon D2 Flash

February 9th, 2008

I have written another little Flash app for my Cowon D2.

If you have a D2 (or a Clix - I’m guessing it will work), then here is my program.

The original problem was getting the D2 to save, which seems to be fixed now in this firmware version (I am using 3.54).

To save some data:
mydata=”Hello World!”;
fscommand2(”SetPersistentData”, “data=” + mydata);

Then to retrieve it:
fscommand2(”GetPersistentData”, “data”);

The larger bulk of the programming for this app was coding the text edit field and getting things like return, backspace, and the cursor keys to work.

If people find my app useful, then I might take the time to add multiple save files. Let me know!