February 4th, 2008 by Kyle
Tags: , , , ,
Posted in: Air

I have been working on a few Adobe AIR projects and along the way as I run into what I feel will be common pieces of functionality to many of the AIR applications I may write, I have been abstracting that functionality and breaking it out into various Flex library projects. After reading the the Developer Center article on Managing Adobe AIR updates with ColdFusion 8, which helped me understand the general process, I decided to tailor the code that I was using in my current AIR application.

What I came up with was a pretty simple approach. I decided to use information that was available in the application descriptor ([appname]-app.xml) for update purposes. In setting values for 3 of the keys in the application descriptor with deliberate usage in mind, the information necessary to deal with determining version dominance, location of the latest version info and installers would be readily accessible.

I figured that if the current, running application was going to get it’s version and update information from the application descriptor, then just having that information available in the same format somewhere on the web to download would make for a simple architecture. By using the “applicationID” and “appFileName” to construct a url to this “latest version” application descriptor, I could easily grab this XML and read from it the “appVersion” to compare against the current appVersion. If the latest appVersion is greater than the current appVersion, then the new application installer could be located at a url I contruct from the applicationID, appFileName and appVersion. Here is how I contruct these two URLs from keys within the application descriptor:

currentVersionInfoURL = "http://" + applicationID + "/"+ appFileName + "-app.xml";
currentApplicationInstallerURL = "http://" + applicationID  + "/" + appFileName + "." + appVersion + ".air";

From this, you can see how I use appFileName and appVersion. That is pretty straight forward. Each new AIR installer that I distribute will just follow this naming convention. The applicationID usage is a little less clear, but here is how I use it. For each application that I build, I create a subdomain off of my main domain. Then, I map that subdomain to a folder. When I create a new build for release, I increment the appVersion key in the application descriptor and in that folder, I place the latest application installer and the corresponding application descriptor.

More details on this library can be found at its Google Code project home: http://code.google.com/p/flex-monkey-patches-upda-man/.
Later this week, I will also be posting a useful little AIR application with source code that makes use of this library and should serve as a good sample for this functionality.


No Comments »

This issue came to me from a customer who wanted to catch the timeout of a webservice and then repeatedly re-dispatch the same webservice passing the parameters/data from the original call, but with a larger timeout, until some max timeout or max number of tries was reached.

Read the rest of this post»


No Comments »

This post is to carry on from my previous post regarding moving data from ColdFusion CFCs to Flex 2 Applications Using Webservices.

Here is the first sample showing basic retrieval of a string via Remote Object:

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" >
    <mx:Script>
        <![CDATA[
            import mx.rpc.events.ResultEvent;
            import mx.controls.Alert;
           
            [Bindable]
            public var sResult:String;
           
            public function handleStringResult(event:ResultEvent):void{
                sResult=event.result as String
            }
         
        ]]>
    </mx:Script>
       
    <mx:RemoteObject
        id="myService"
        destination="ColdFusion"
        source="services.HelloWorld">  
        <mx:method name="sayHelloString" result="handleStringResult(event)"  fault="Alert.show(event.fault.message)" />
    </mx:RemoteObject>

    <mx:Label id="lblStringResult" text="{sResult}"/>   
    <mx:Button label="get String Remote Object" click="myService.sayHelloString()"/>

</mx:Application>
 

This movie requires Flash Player 9

Browse the source of this example.
Download a zipfile containing the source to this sample.

Read the rest of this post»


No Comments »

I am using HostMySite as my web host and have the Linux Builder Plus CF package.
I haven’t upgraded to CF8 since that would require me to change my host package to use Windows. I don’t think I want that, since I like having SSH access to the machine my site is physically on.
I had just finished with my blog regarding Moving data from ColdFusion CFCs to Flex 2 Applications Using Webservices and was trying to get my code working on my site for the follow up article on Moving data from ColdFusion CFCs to Flex 2 Applications Using RemoteObject.
I was not being very successful and had even spoken with HostMySite support and they told me that accessing cfcs from Flex as RemoteObjects through the Flex Gateway with Coldfusion was not enabled and furthermore could not be enabled for a shared hosting account. If I wanted that functionality, I would have to upgrade to a VPS (Virtual Private Server) host package.
Now I pay about $65 per quarter for my host account for CF and Wordpress capabilities. The base VPS host package with Coldfusion starts at $116 a month. I don’t know about you, but that is quite a jump for me, so I decided to do a bit more digging around. As it turned out, I found a few forum entries that seemed to allude that it was possible. In fact, one person had even posted to a link in his hosted site where he actually had my dev center article remote object sample working! Unfortunately he didn’t quite say how he had accomplished such a feat.
Well I knew how I would deal with that mystery. I got out my trusty Web Debugging Proxy tool: Charles to sniff the request that the sample was making so I could see what the url was to the flex gateway. As it turns out, I was just missing a trailing slash on my flex2gateway URI!!!!!

The key to getting this to work revolves around 3 things:
1. Getting your config files located and configured properly for compilation.
2. Getting the fully qualified name for your cfc correct.
3. Knowing the endpoint URI for your Flex Gateway fro your Coldfusion server.
Read the rest of this post»


No Comments »

One of my first blog posts pointed to a dev center article that I wrote on this topic for the Flex 2 release. I often send customers to look at this article when appropriate as it is a good starting point for webservice and remoteobject communication between Flex and Coldfusion. I also find myself referring to this sample once in a while and so I have finally decided to host the sample and cfc from my website/blog and potentially enhance the cfc to support more use cases for subsequent blog posts.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" >
    <mx:Script>
        <![CDATA[
            import mx.rpc.events.ResultEvent;
            import mx.controls.Alert;
           
            [Bindable]
            public var sResult:String;
               
            public function handleStringResult(event:ResultEvent):void{
                sResult=event.result as String
            }
           
        ]]>
    </mx:Script>
       
    <mx:WebService id="myService"
        useProxy="false"
        wsdl="http://739saintlouis.com/services/HelloWorld.cfc?wsdl"
        showBusyCursor="true">     
        <mx:operation name="sayHelloString" result="handleStringResult(event)" fault="Alert.show(event.fault.message)"/>
    </mx:WebService>
    <mx:Label id="lblStringResult" text="{sResult}"/>   
    <mx:Button label="get String via Webservice" click="myService.sayHelloString.send()"/>

</mx:Application>
 

This movie requires Flash Player 9

Browse the source of this example.
Download a zipfile containing the source to this sample.

Read the rest of this post»


2 Comments »

I wrote this article for the Flex 2.0 release.
It is a good intro on how you can move data between Coldfusion 7.02 CFCs and Flex 2.0 using Web Services or Remote Object calls.

My co-worker, Lin Lin, blogged a good follow up to this article that expands up on the configuration and steps necessary to access cfcs on your Coldfusion server from a flex app on a separate server.


No Comments »