Flexi-ng your muscles with Gears




When a lot of developers think about Flex, they often tie it to Flash and AIR, but you can of course integrate Flex applications with many other front-end services.

Mrinal Wadhwa has seen value in building Flex applications, and also likes functionality available in Gears.

He wrote up an article on enhancing Flex applications with Gears which had him create a sample application the uses the Desktop API in Gears.

It is interesting to take a look at the source to see how Flex applications tie back to plain old JavaScript.

For example, the following shows you how you put JavaScript into your Flex application, and then call back to the Flex code via thisMovie(APP_NAME).methodToCall:
<JavaScript>
// tells the swf if gears is installed
function isGearsInstalled() {
if (window.google && google.gears) { //gears is installed
thisMovie("FlexGears").testForGears(true);
return;
}
//gears is not installed
thisMovie("FlexGears").testForGears(false);
}


function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
// ....
</JavaScript>
Thanks to Mrinal Wadhwa for taking the time to try this all out. We enjoy seeing how people take Gears into many corners of the Web!

Also, you may not have seen QuickFix, an example application that shows how you can use Flex to talk to Google App Engine. The example is created by Dick Wall from App Engine, and James Ward from Adobe.