Flex 3/AIR version of CFLib demo

Yesterday I released an AIR application that lets you browser CFLib.org from your desktop. This application didn’t take terribly long - except for some issues I ran into with the new security model.

Today I thought I’d try it with Flex. I’m a bit rusty with Flex but I figured it couldn’t be too hard. Turns out I was right. With some help from Scott Stroz and Simeon Bateman, I was able to crank out the application in a lunch break.

The only part that confused me was - how do I use RemoteObject to talk to a CFC on another server, which AIR allows? Turns out you just need to get a copy of CF’s services-config.xml file. I placed it in my Flex app and added this to my compile args:

-services libs/services-config.xml

Next, I edited the file to change

<endpoint uri="http://{server.name}:{server.port}{context.root}/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>

to

<endpoint uri="http://www.cflib.org:80/flex2gateway/" class="flex.messaging.endpoints.AMFEndpoint"/>

That’s it. I guess it really isn’t much of an AIR app. It doesn’t detect online/offline. But I find it cool that it took me 1/5th the time and came out ten times prettier. I’ve included the AIR app as a download. I renamed it to cflib.zip as I’m too lazy to mess with IIS settings. Rename it and run. If you ran the demo from yesterday, the installer will complain that an application with the same name exists. Either uninstall the other one or supply a custom install location.

Also - I used Flex Builder’s Include Source option so you can see my ugly MXML code. Awesome.<p>Download attached file.</p>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Comments