I took some time this weekend and helped my wife update her site. I talked her into letting me build a little flex header that displays the photos from her flickr stream. My wife takes a few pictures of our daughter everyday with her iPhone and posts them to flickr, so I thought this would be a neat way to update the site between blog posts.

It took about 20 minutes to through together the first draft. I just grabbed her flickr feed as json and use the corelib to eval it into some objects. Then used mx:Image objects to load the pictures and display them horizontally inside the application.

But this simple swf was 170kb. Now I know that in todays world of fat bandwidth that is just a drop in the bucket, but I saw this as an opportunity to do some AS3 application work without the aide of the mx packages.

The result, after about 2 hours of work is the exact same end product. But it only weighs in at 9kb. While I achieved my end goal in reproducing the flex application, this process was nothing like what I expected. First off… flash has no layout containers! None? As a flex developer being able to set the layout property of the Application or using HBox and VBox to layout components. How the hell did flash developers manage before flex? Everything pixel positioned? You are kidding right? So I wrote a basic LayoutManger and HBox and VBox components that work in AS3 and support basic gap and scrollposition properties. You can see the source for the header and the layout managers here.

Other tricks that stumped me but where easily solved by a quick visit with Ben Stucki, are to set the scale mode and alignment of the swf so that it works like I expect from flex.

this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.align = StageAlign.TOP_LEFT;

Another neat trick was that I have become accustomed to setting height and width on my application and having it sized correctly. In AS3 you can use the SWF metadata tag to set the size of flash player display.

[SWF( height=’150′, width=’975′)]

Anyway, after building something without the benefit of the Flex framework, I have a new appreciation for the Flex SDK. So let me just take this second to thank all the Flash developers that have come before me for achieving so much and proving the rest of us with such an amazing tool set. And thanks to Adobe for providing the results that work and knowledge to us as an open source sdk.