Vixiom Axioms

August 24, 2007

Sorting Images with a Flex Tile Component

Filed under: ActionScript, Flash, Flex, RIA, Ruby on Rails Alastair @ 12:24 pm

This is a test for an image manager component that I’m building. The final version will have an upload feature, and when you sort the images they’ll hook up with their model in Rails using acts_as_list to save the sorting in the database. Right click the swf below to view source.

I’ve built something similar in Flash/AS2, and without sounding too much like a Adobe marketing rep, I have to say it’s so much easier in Flex/AS3. AS2 doesn’t have ArrayCollections so moving things around in an array was a bit of a headache, but in AS3 you can just remove an item from a list ( myCollection.removeItemAt(x) ) and then place it back anywhere ( myCollection.addItemAt( item, x ) ) and all the other items will shift down the list.

Another big time saver is the DragManager in AS2 you had to manually handle all kinds of dragging functions but with AS3 you just add a couple of events and you’re done. Even the Tile component saves having to layout the images by hand.

Anyways long story short the AS2 version took a couple of days to build and the Flex version took a couple of hours.

Digg! submit Sorting Images with a Flex Tile Component to stumbleupon.com submit Sorting Images with a Flex Tile Component to del.icio.us submit Sorting Images with a Flex Tile Component to reddit.com Like this post? subscribe to the feed.

4 Comments »

  1. Cool example. Fits right in to my application. Works like a charm! Thanks.

    Comment by Per Madsen — September 3, 2007 @ 11:32 am

  2. I’m still trying to figure out what you can do in Flex that you can’t do in the flash IDE. You said that it was easier with flex/as3 than with flash/as2 — wouldn’t it be relatively the same to build it in flash/as3 ?

    Comment by G — October 30, 2007 @ 11:52 am

  3. Yes you could build the same thing with Flash and CS3 but Flex really is a framework in that it gives you so many useful components to build upon. I can complete a project in Flex in 50-75% of the time it took me in Flash.

    I was a Flex skeptic for a while and I hated it the first couple of weeks because you have to change how you approach stuff but now I love it (Flex 3 is a big improvement on 2).

    One thing Flash doesn’t have error checking on the fly. In Flex Builder you’ll know right away if you have an error, in Flash you have to compile first then get the warning.

    Comment by Alastair — October 30, 2007 @ 1:05 pm

  4. Solved my issue! Thanks a lot!

    Ved

    Comment by Vedovelli — December 16, 2007 @ 7:30 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image

Powered by WordPress