Flex

Flex Example: Right-Click -> Save Image As

One of the things that is available in HTML web pages but usually left out of Flex applications is the ability to save images by right-clicking on them. This is not because it’s not possible with Flex - rather it just requires a little extra coding. So I created a simple Flex example that adds the “Save Image As” right-click menu item. Check out the demo and the source code.

Flex Example - Save Image As

Take the Tour de Flex

I recently recorded a video about how to use Tour de Flex for Adobe TV. Check out the video below and if you haven’t already done so, install Tour de Flex by clicking on the installer badge located in the left column of this blog.

How would you write this ActionScript code?

I was just watching Lee Brimelow’s fantastic video about Flash Catalyst and Flash Builder and noticed some Flex / ActionScript code (generated by Flash Catalyst) that caught my attention:

var state:String = currentState;
if ( state == 'closed' ) {
    currentState='open';
}
if ( state == 'open' ) {
    currentState='closed';
}

This code just toggles the currentState property between ‘open’ and ‘closed’. I initially thought that the code was not very elegant in that form but that maybe there was a reason it was written like that. Maybe Flash Catalyst needs it in that form to understand it. Maybe it’s more efficient for the VM to run. I’m not totally sure. But it made me curious… How would you write the same functionality? Use a ternary operator? A switch statement? If - else if? If - else? And why would you do it that way? Is it your personal preference, are there performance implications, SWF size implications, is your way more readable, or are there other factors? While programming provides us many ways to express our creative freedom it seems that for common patterns like this there might be a universal “best way” to do this. Or perhaps this is just another tabs versus spaces kind of issue. I’d love to hear what the community thinks!

Flex and Salesforce / Force.com Updates

There have been a lot of exciting things happening with Flex and Salesforce / Force.com lately. First Ryan Marples recently announced the release of an updated version of the Force.com Toolkit for Adobe AIR and Flex. If you are doing development with Flex and Salesforce or Force.com you should download this new release to take advantage of the latest enhancements to the web services APIs.

Today Adobe updated the Adobe Developer Connection’s page containing information about integrating Flex and Salesforce / Force.com. This new page contains new videos, demos, articles, and other great content. Check it out and let us know what you think.

Flex in Zurich and Copenhagen Next Week

With the recent beta releases of Flash Builder 4 and Flash Catalyst there is a lot of fun stuff going on. Next week I’ll be speaking in Zurich at Jazoon on Tuesday about RIAs with Java, Spring, Hibernate, BlazeDS, and Flex. On Wednesday I’ll be speaking in Copenhagen about Flex 4 and Flash Catalyst. Thursday I’m back in Zurich speaking about Flex 4. And finally on Friday I’ll be speaking at Flash at the Lake about Pixel Bender and pbjAS. Lots of fun stuff! I hope to see some of you along the way.

Blazing Fast Data Transfer in Flex

A while back I created the Census RIA Benchmark to illustrate the benefits of having both a high performance client VM and a binary serialization protocol. These factors combined lead to significantly faster data transfer and rendering for large datasets in rich Internet applications. Recently I created an Adobe TV video that walks through Census and how to use Flex and BlazeDS to take advantage of these benefits. Check it out and let me know what you think.

DZone Podcast about Adobe AIR, Flex, and Java

I recently recorded a podcast with James Sugrue for DZone. In the podcast we talk about why Flex and Adobe AIR are relevant to Java developers. You can either listen to the podcast or read transcribed text. It’s good to see DZone doing a lot more Flex related content including the Refcardz I’ve co-authored: Very First Steps in Flex and Flex and Spring Integration.

Let me know what you think of the podcast. Thanks!

Announcing pbjAS – An ActionScript 3.0 Pixel Bender Shader Library

One of the major new features in Flash Player 10 is Pixel Bender. Like its name suggests, the primary purpose of Pixel Bender is to allow you to easily manipulate pixels inside a Flash application. A great demo of this is the FotoBooth application, which applies different filters to webcam input. While tweaking pixels is the primary purpose of Pixel Bender, it can also be used as a multi-threaded number crunching machine. You can pass it some numbers, have it perform some mathematical operations on those numbers, and then return the result. This opens up some very interesting opportunities to get outside of the normal single-threaded nature of ActionScript in Flash Player.