<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>James Ward - RIA Cowboy &#187; Salesforce.com</title>
	<atom:link href="http://www.jamesward.com/category/salesforce/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jamesward.com</link>
	<description>Rich Internet Applications &#124; Flex &#124; Adobe AIR &#124; Java &#124; Open Source &#124; Linux &#124; Enterprise Software &#124; Cloud</description>
	<lastBuildDate>Mon, 26 Jul 2010 19:15:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Building Client / Cloud Apps with Flash Builder for Force.com</title>
		<link>http://www.jamesward.com/2010/07/26/building-client-cloud-apps-with-flash-builder-for-force-com/</link>
		<comments>http://www.jamesward.com/2010/07/26/building-client-cloud-apps-with-flash-builder-for-force-com/#comments</comments>
		<pubDate>Mon, 26 Jul 2010 19:15:25 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Adobe AIR]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1894</guid>
		<description><![CDATA[I have a theory. The majority of people who use enterprise software today use old school Client / Server apps. We&#8217;ve been trying to move these apps to the web for more than ten years. The ease of deployment of web apps is a clear motivator. Yet the client capabilities of the plain old web [...]]]></description>
			<content:encoded><![CDATA[<p>I have a theory.  The majority of people who use enterprise software today use old school Client / Server apps.  We&#8217;ve been trying to move these apps to the web for more than ten years.  The ease of deployment of web apps is a clear motivator.  Yet the client capabilities of the plain old web browser have not been sufficient for many apps to make the leap.  This is why I love Flex and the Flash Platform.  It provides a way to use web technologies and the web deployment model but adds many of the critical things needed for mission critical apps that people use all day long.</p>
<p>But no one wants to go back to the Client / Server architecture.  We want to embrace Cloud Computing architectures but not lose the client capabilities.  What we really need is the Client / Cloud architecture.  We need a web deployment model that provides ease of deployment but also the ability to install applications on our desktops and mobile devices.</p>
<p>This is why I&#8217;m so excited about the new <a href="http://developer.force.com/flashbuilder">Adobe Flash Builder for Force.com</a>.  In a nutshell this is a tool that Adobe and Salesforce.com built together to enable developers to build great software using Flex for the UI and Force.com for the Cloud back-end.  It&#8217;s a wonderful combination of technologies that will help many Client / Server apps make the switch to Client / Cloud.</p>
<p>Applications created with Flash Builder for Force.com can be run in the browser, on the desktop, and on mobile devices.  These applications can be assembled from the hundreds of Flex components that are out there (check out many of them in <a href="http://flex.org/tour">Tour de Flex</a>).</p>
<p>Check out this video to see how to use Flash Builder for Force.com to build a simple app:</p>
<p><object width="640" height="385"><param name="movie" value="http://images.tv.adobe.com/swf/player.swf"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><param name="FlashVars" value="fileID=7230&#038;context=64&#038;embeded=true&#038;environment=production"></param><embed src="http://images.tv.adobe.com/swf/player.swf" flashvars="fileID=7230&#038;context=64&#038;embeded=true&#038;environment=production" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
<p>As you can see, it&#8217;s very easy to get started.  But I wanted to go a step further and try to build something real&#8211;something that shows a genuine use case for extending beyond the out-of-the-box Salesforce.com UI.  I wanted to keep it really simple so that I could post the code here.  What I came up with is this (in user story form):</p>
<ul>
<li>As a Salesforce.com user I want to take a photo, using my phone, of one of my contacts so that the photo can be saved to their contact record for future reference.</li>
<li>As a Salesforce.com user I want to see photos I&#8217;ve taken of my contacts so that I can be reminded of what they look like.</li>
</ul>
<p>Simple enough.  So here is what I came up with:</p>
<p><object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/RIUwh6wk8cY&amp;hl=en_US&amp;fs=1?rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/RIUwh6wk8cY&amp;hl=en_US&amp;fs=1?rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object></p>
<p>To build these two apps I first downloaded and installed <a href="https://www.developerforce.com/events/flashbuilder/registration.php">Flash Builder for Force.com</a>.  I used the <a href="http://www.adobe.com/go/airbetasignup">Adobe AIR for Android prerelease</a> to build the mobile app.  Here is how I created these apps.</p>
<p>First I added a new field to Contact to store the photo.  Salesforce.com doesn&#8217;t have a binary field so I used a large text field (32k limit).  I&#8217;ll store the photo Base64 encoded.</p>
<p>Then in Salesforce.com I saved my enterprise.wsdl file. Check out a <a href="http://wiki.developerforce.com/index.php/Demo_Building_Desktop_Client_for_the_Cloud">great video from Dave Carroll</a> to see how to do this.</p>
<p>Now in Flash Builder for Force.com I created a new Force.com Flex Project for the mobile app.  If you do this on your own and want to run on a mobile device then you will need to overlay the AIR for Android SDK on top of a Flex 4.1 SDK.  Select Desktop Application as the app type.  Replace WindowedApplication with just Application.  And replace the F3DesktopApplication with F3WebApplication since F3DesktopApplication uses APIs that are not available on AIR for Android.  (BTW: Flash Builder, Flex, and Force.com Flex Projects do not officially support mobile deployment yet.  It works but there is no support and no guarantees.)  If you are building a standard Web Application or Desktop Application then you can just leave the generated code as is.</p>
<p>Using the Data/Services wizard I connected to Salesforce.com using my enterprise.wsdl file.  After the services and value objects have been generated I modified the Contact object and added a Bindable account property.  The generated application already included the F3DesktopApplication Declaration used to connect to Salesforce.  Due to an incompatibility with that API and AIR for Android I switched it to use F3WebApplication.  In F3WebApplication&#8217;s loginComplete event handler I query Salesforce.com for Accounts and then Contacts, associate contacts with their account, and then store the contacts:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">app.<span style="color: #006600;">wrapper</span>.<span style="color: #006600;">query</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;select Id, Name from Account&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> AsyncResponder<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>:ArrayCollection, token:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    accounts = <span style="color: #0066CC;">data</span>;
    app.<span style="color: #006600;">wrapper</span>.<span style="color: #006600;">query</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;select Id, AccountId, FirstName, LastName, Phone, MobilePhone, Email, Title, Department, MailingCity, photoData__c from Contact&quot;</span>, <span style="color: #000000; font-weight: bold;">new</span> AsyncResponder<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>:ArrayCollection, token:<span style="color: #0066CC;">Object</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> contact:Contact <span style="color: #b1b100;">in</span> <span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> account:Account <span style="color: #b1b100;">in</span> accounts<span style="color: #66cc66;">&#41;</span>
            <span style="color: #66cc66;">&#123;</span>
                <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>account.<span style="color: #006600;">Id</span> == contact.<span style="color: #006600;">AccountId</span><span style="color: #66cc66;">&#41;</span>
                <span style="color: #66cc66;">&#123;</span>
                    contact.<span style="color: #006600;">account</span> = account;						
                <span style="color: #66cc66;">&#125;</span>
            <span style="color: #66cc66;">&#125;</span>
        <span style="color: #66cc66;">&#125;</span>
        contacts = <span style="color: #0066CC;">data</span>;
    <span style="color: #66cc66;">&#125;</span>, handleError<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>, handleError<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>Notice in the query that I&#8217;m fetching photoData__c, which is the custom field I created on Contact to store the photo.</p>
<p>In the renderer for a contact I need to either display the photo if there is one or let the user add one.  Here is the simple UI code to handle that:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Group</span> width=<span style="color: #ff0000;">&quot;92&quot;</span> height=<span style="color: #ff0000;">&quot;92&quot;</span> top=<span style="color: #ff0000;">&quot;8&quot;</span> right=<span style="color: #ff0000;">&quot;8&quot;</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> width=<span style="color: #ff0000;">&quot;92&quot;</span> height=<span style="color: #ff0000;">&quot;92&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;#cccccc&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;addPhoto&quot;</span> text=<span style="color: #ff0000;">&quot;Add a photo&quot;</span> width=<span style="color: #ff0000;">&quot;92&quot;</span> height=<span style="color: #ff0000;">&quot;92&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> textAlign=<span style="color: #ff0000;">&quot;center&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapImage</span> id=<span style="color: #ff0000;">&quot;photo&quot;</span> width=<span style="color: #ff0000;">&quot;92&quot;</span> height=<span style="color: #ff0000;">&quot;92&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Group</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>When the contact is set I check to see if there is a photo and if so display it:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>contact.<span style="color: #006600;">photoData__c</span> == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    photo.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">false</span>;
    <span style="color: #b1b100;">return</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> decoder:Base64Decoder = <span style="color: #000000; font-weight: bold;">new</span> Base64Decoder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
decoder.<span style="color: #006600;">decode</span><span style="color: #66cc66;">&#40;</span>contact.<span style="color: #006600;">photoData__c</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> loader:Loader = <span style="color: #000000; font-weight: bold;">new</span> Loader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
loader.<span style="color: #006600;">contentLoaderInfo</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
    photo.<span style="color: #006600;">source</span> = event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">content</span>;
    photo.<span style="color: #0066CC;">visible</span> = <span style="color: #000000; font-weight: bold;">true</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
loader.<span style="color: #006600;">loadBytes</span><span style="color: #66cc66;">&#40;</span>decoder.<span style="color: #006600;">toByteArray</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The data from the photoData__c field is Base64 decoded and then displayed using the Flex BitmapImage component.</p>
<p>Now when the user clicks on the photo or empty photo box I use the AIR for Android CameraUI to grab a photo, resize it, covert it to a PNG, Base64 encode it, set it on the contact, and then save the contact to Salesforce.com:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>CameraUI.<span style="color: #006600;">isSupported</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    cameraUI = <span style="color: #000000; font-weight: bold;">new</span> CameraUI<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    cameraUI.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MediaEvent.<span style="color: #006600;">COMPLETE</span>, <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event:MediaEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">var</span> loader:Loader = <span style="color: #000000; font-weight: bold;">new</span> Loader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        loader.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span>event.<span style="color: #0066CC;">data</span>.<span style="color: #006600;">file</span>.<span style="color: #0066CC;">url</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
        loader.<span style="color: #006600;">contentLoaderInfo</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>, <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event:Event<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #000000; font-weight: bold;">var</span> bitmap:Bitmap = event.<span style="color: #0066CC;">target</span>.<span style="color: #006600;">content</span> as Bitmap;
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> result:BitmapData = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">46</span>, <span style="color: #cc66cc;">46</span>, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #000000; font-weight: bold;">var</span> matrix:Matrix = <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            matrix.<span style="color: #006600;">scale</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">46</span> <span style="color: #66cc66;">/</span> bitmap.<span style="color: #0066CC;">width</span>, <span style="color: #cc66cc;">46</span> <span style="color: #66cc66;">/</span> bitmap.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
            result.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>bitmap, matrix<span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> pngEncoder:PNGEncoder = <span style="color: #000000; font-weight: bold;">new</span> PNGEncoder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #000000; font-weight: bold;">var</span> pngBytes:ByteArray = pngEncoder.<span style="color: #006600;">encode</span><span style="color: #66cc66;">&#40;</span>result<span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #000000; font-weight: bold;">var</span> base64Encoder:Base64Encoder = <span style="color: #000000; font-weight: bold;">new</span> Base64Encoder<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
            base64Encoder.<span style="color: #006600;">encodeBytes</span><span style="color: #66cc66;">&#40;</span>pngBytes<span style="color: #66cc66;">&#41;</span>;
            <span style="color: #000000; font-weight: bold;">var</span> encodedImage:<span style="color: #0066CC;">String</span> = base64Encoder.<span style="color: #0066CC;">flush</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            contact.<span style="color: #006600;">photoData__c</span> = encodedImage;
&nbsp;
            displayPhoto<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            F3WebApplication.<span style="color: #006600;">getInstance</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">wrapper</span>.<span style="color: #006600;">save</span><span style="color: #66cc66;">&#40;</span>contact, <span style="color: #000000; font-weight: bold;">new</span> AsyncResponder<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">data</span>:<span style="color: #0066CC;">Object</span>, token:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #66cc66;">&#125;</span>, FlexGlobals.<span style="color: #006600;">topLevelApplication</span>.<span style="color: #006600;">handleError</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
    cameraUI.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ErrorEvent.<span style="color: #0066CC;">ERROR</span>, <span style="color: #000000; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event:ErrorEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
        FlexGlobals.<span style="color: #006600;">topLevelApplication</span>.<span style="color: #006600;">handleError</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
    cameraUI.<span style="color: #006600;">launch</span><span style="color: #66cc66;">&#40;</span>MediaType.<span style="color: #006600;">IMAGE</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>That&#8217;s it for the mobile app!  I compiled it, exported it to an Android app, and then copied it to my phone.  Pretty simple and as you can see it works!  One limitation with my approach is the 32k limit of the photoData__c field.  However, I think I could easily get around that by striping the Base64 encoded data across multiple fields.  It&#8217;s not ideal but it would work.</p>
<p>To display the photo when I view a contact on Salesforce.com I created a very simple Flex app using another Force.com Flex Project.  I could have also added photo upload to this application but chose to keep it simple.  All it does is display the selected contact&#8217;s photo.  Here is the complete code (after generating the required services in Flash Builder):</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span></span>
<span style="color: #000000;">    xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #000000;">    xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span></span>
<span style="color: #000000;">    xmlns:flexforforce=<span style="color: #ff0000;">&quot;http://flexforforce.salesforce.com&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>		
    import mx.rpc.AsyncResponder;
    import mx.utils.Base64Decoder;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;flexforforce:F</span>3WebApplication id=<span style="color: #ff0000;">&quot;app&quot;</span> requiredTypes=<span style="color: #ff0000;">&quot;Contact&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;flexforforce:loginComplete</span><span style="color: #7400FF;">&gt;</span></span>
                app.wrapper.query(&quot;select photoData__c from Contact where Id = '&quot; + this.parameters.contactId + &quot;'&quot;, new AsyncResponder(function(data:Object, token:Object):void {
                    if (data.length == 1)
                    {
                        if (data[0].photoData__c == null)
                        {
                            photo.visible = false;
                            noPhoto.visible = true;
                            return;
                        }
&nbsp;
                        var decoder:Base64Decoder = new Base64Decoder();
                        decoder.decode(data[0].photoData__c);
&nbsp;
                        var loader:Loader = new Loader();
                        loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(event:Event):void {
                            photo.source = event.target.content;
                            photo.visible = true;
                        });
                        loader.loadBytes(decoder.toByteArray());
                    }
                }, function(fault:Object):void {
                    // ignored
                }));
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;/flexforforce:loginComplete</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/flexforforce:F</span>3WebApplication<span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Declarations</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:applicationComplete</span><span style="color: #7400FF;">&gt;</span></span>
        app.serverUrl = this.parameters.serverUrl;
        app.loginBySessionId(this.parameters.sessionId);
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:applicationComplete</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Rect</span> width=<span style="color: #ff0000;">&quot;92&quot;</span> height=<span style="color: #ff0000;">&quot;92&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:fill</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:SolidColor</span> color=<span style="color: #ff0000;">&quot;#cccccc&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:fill</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Rect</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Label</span> id=<span style="color: #ff0000;">&quot;noPhoto&quot;</span> text=<span style="color: #ff0000;">&quot;No Photo&quot;</span> width=<span style="color: #ff0000;">&quot;92&quot;</span> height=<span style="color: #ff0000;">&quot;92&quot;</span> textAlign=<span style="color: #ff0000;">&quot;center&quot;</span> verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span> visible=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BitmapImage</span> id=<span style="color: #ff0000;">&quot;photo&quot;</span> width=<span style="color: #ff0000;">&quot;92&quot;</span> height=<span style="color: #ff0000;">&quot;92&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Finally I created a custom S-Control to run the Flex app:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">object</span> <span style="color: #000066;">classid</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ContactPhoto&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;92&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;92&quot;</span> </span>
<span style="color: #009900;"><span style="color: #000066;">codebase</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;https://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab&quot;</span>&gt;</span> 
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;movie&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{!Scontrol.JavaArchive}&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> 
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">param</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;flashvars&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sessionId={!API.Session_ID}&amp;serverUrl={!API.Partner_Server_URL_90}&amp;contactId={!Contact.Id}&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span> 
    <span style="color: #009900;">&lt;embed <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{!Scontrol.JavaArchive}&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;92&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;92&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ContactPhoto&quot;</span> </span>
<span style="color: #009900;">flashvars<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;sessionId={!API.Session_ID}&amp;serverUrl={!API.Partner_Server_URL_90}&amp;contactId={!Contact.Id}&quot;</span> </span>
<span style="color: #009900;"><span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;application/x-shockwave-flash&quot;</span> </span>
<span style="color: #009900;">pluginspage<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.adobe.com/go/getflashplayer&quot;</span>&gt;</span> 
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span>embed&gt;</span> 
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">object</span>&gt;</span></pre></div></div>

<p>I uploaded the compiled Flex app to the S-Control and added it to the Contact page.  And that&#8217;s it!  In just a few hours I extended Force.com and built a cool mobile app.  I could also have easily created a desktop widget for browsing contacts and adding photos.  If you are looking for a fun project to use as a way to learn this stuff that would be a good one!  :)</p>
<p>Here are some resources to help you get started with Flash Builder for Force.com:</p>
<ul>
<li><a href="http://wiki.developerforce.com/index.php/Force.com_Flex_Quick_Start_Tutorial">Force.com Flex Quick Start Tutorial</a></li>
<li><a href="http://developerforce.s3.amazonaws.com/website/afb/docs/ASDoc_Flex/index.html">Force.com Flex Project APIs for Web Applications</a></li>
<li><a href="http://developerforce.s3.amazonaws.com/website/afb/docs/ASDoc_AIR/index.html">Force.com Flex Project APIs for Desktop Applications</a></li>
<li><a href="http://developer.force.com/flashbuilder">Numerous other demo applications and tutorials</a></li>
<li><a href="http://github.com/jlward4th/MobileContacts">Source code for my mobile contacts demo</a></li>
<li><a href="http://github.com/jlward4th/WebContactSControl">Source code for my web contact photo viewer demo</a></li>
</ul>
<p>Have fun building the next generation of software!  Let me know how it goes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/07/26/building-client-cloud-apps-with-flash-builder-for-force-com/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flash Platform and Salesforce.com Webinar and Mobile App</title>
		<link>http://www.jamesward.com/2010/05/26/flash-platform-and-salesforce-com-webinar-and-mobile-app/</link>
		<comments>http://www.jamesward.com/2010/05/26/flash-platform-and-salesforce-com-webinar-and-mobile-app/#comments</comments>
		<pubDate>Wed, 26 May 2010 16:59:31 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1730</guid>
		<description><![CDATA[Client + Cloud technologies have been quickly evolving and maturing. The combination of Flex and Salesforce.com continue to lead the way for next generation Client + Cloud applications. Recently I did a Webinar on The Flash Platform and Salesforce.com with Dave Carroll from Salesforce. If you missed it you can watch the recording to see [...]]]></description>
			<content:encoded><![CDATA[<p>Client + Cloud technologies have been quickly evolving and maturing.  The combination of Flex and Salesforce.com continue to lead the way for next generation Client + Cloud applications.  Recently I did a <a href="http://seminars.adobe.acrobat.com/p26603860/">Webinar on The Flash Platform and Salesforce.com</a> with Dave Carroll from Salesforce.  If you missed it you can watch the recording to see how you can begin developing Client + Cloud apps.  Also <a href="http://blog.jeffdouglas.com/2010/02/01/adobe-air-applications-with-salesforce/">watch Jeff Douglas demo an offline case management app</a> he built with Flex and Force.com.  Awesome stuff!</p>
<p>Last week I was able to spend a few hours with <a href="http://www.modelmetrics.com">Model Metrics</a> porting their <a href="http://www.modelmetrics.com/solutions/2go-mobile-cloud-platform/">Pharma2GO Adobe AIR app</a> to run on an Android Mobile device.  Using the <a href="http://labs.adobe.com/technologies/air2/android/">AIR for Android Prerelease</a> we quickly created a mobile friendly UI with Flex and reused the same data sync code from the desktop app.  Check out the end result:<br />
<object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/Lle24eGjNBs&#038;hl=en_US&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/Lle24eGjNBs&#038;hl=en_US&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="385"></embed></object></p>
<p>Listen to what Model Metrics had to say about this in their blog &#8220;<a href="http://www.modelmetrics.com/general/html-5-%E2%80%93-ready-for-primetime-in-the-enterprise/">HTML 5 – Ready for Primetime in the Enterprise?</a>&#8220;:</p>
<blockquote><p>One of our early iPhone products on the iTunes AppStore was Search2GO, a simple search tool for Salesforce.com.  This was built in Objective C and it took approximately 8 weeks to develop.  Yesterday I watched two developers create over half of this same functionality using Flex/AIR and had it running on an Android phone in a day.  Granted there are still things that could be added, but this was a great illustration of why Flex/AIR is a great toolset.</p></blockquote>
<p>These are exciting times for Client + Cloud apps now that the &#8220;Client&#8221; can easily be on the web, desktop, and mobile device using the same technologies and tools!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/05/26/flash-platform-and-salesforce-com-webinar-and-mobile-app/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flex and The Cloud</title>
		<link>http://www.jamesward.com/2010/01/19/flex-and-the-cloud-2/</link>
		<comments>http://www.jamesward.com/2010/01/19/flex-and-the-cloud-2/#comments</comments>
		<pubDate>Tue, 19 Jan 2010 22:49:53 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Flash Player]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1490</guid>
		<description><![CDATA[The combination of Flex and The Cloud is quickly becoming an IT and paradigm changing combination. Here are a number of recently published resources for learning more about this : An article I wrote has been published on the online Flash &#38; Flex Developer&#8217;s Magazine: Flex and The Cloud: Is this really just Client/Server 2.0? [...]]]></description>
			<content:encoded><![CDATA[<p>The combination of Flex and The Cloud is quickly becoming an IT and paradigm changing combination.  Here are a number of recently published resources for learning more about this :</p>
<ul>
<li>An article I wrote has been published on the online Flash &amp; Flex Developer&#8217;s Magazine: <a href="http://ffdmag.com/download-1-2010">Flex and The Cloud: Is this really just Client/Server 2.0?</a></li>
<li>I&#8217;ll be speaking on <a href="http://ria5280.org/calendar/event/2010/2/18/163821">Thursday, February 18 2010 at the Denver Flex User Group</a> about Flex and The Cloud</li>
<li>The <a href="http://www.adobe.com/cfusion/event/index.cfm?event=list&#038;loc=en_us&#038;type=ondemand_seminar&#038;product=&#038;interest=int_rich_internet_applications&#038;audience=&#038;sdid=EGMQU">recording of a webinar</a> I co-hosted on the new Salesforce.com Cloud platform for developers has been posted</li>
<li>Jeff Douglas has posted <a href="http://blog.jeffdouglas.com/2010/01/11/developing-apps-with-the-stratus-framework/">a video walk through</a> showing how to use the new Salesforce.com Flash Builder 4 extension for Flex + Cloud apps</li>
</ul>
<p>Exciting stuff!  Let me know what you think!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/01/19/flex-and-the-cloud-2/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Right90&#8242;s Super-Sexy Enterprise Flex RIA</title>
		<link>http://www.jamesward.com/2010/01/13/right90s-super-sexy-enterprise-flex-ria/</link>
		<comments>http://www.jamesward.com/2010/01/13/right90s-super-sexy-enterprise-flex-ria/#comments</comments>
		<pubDate>Wed, 13 Jan 2010 19:41:07 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA Cowboy Videos]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1477</guid>
		<description><![CDATA[While at Dreamforce 2009 I was able to see some amazing enterprise Flex RIAs. Here is an RIA Cowboy Video of Right90&#8216;s Sales Forecasting application. Let me know what you think.]]></description>
			<content:encoded><![CDATA[<p>While at Dreamforce 2009 I was able to see some amazing enterprise Flex RIAs.  Here is an RIA Cowboy Video of <a href="http://www.right90.com/">Right90</a>&#8216;s Sales Forecasting application.  Let me know what you think.</p>
<p><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="545" height="349" id="viddler_f0b83e46"><param name="movie" value="http://www.viddler.com/player/f0b83e46/" /><param name="allowScriptAccess" value="always" /><param name="allowFullScreen" value="true" /><embed src="http://www.viddler.com/player/f0b83e46/" width="545" height="349" type="application/x-shockwave-flash" allowScriptAccess="always" allowFullScreen="true" name="viddler_f0b83e46"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2010/01/13/right90s-super-sexy-enterprise-flex-ria/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Salesforce.com and the Adobe Flash Platform eSeminar</title>
		<link>http://www.jamesward.com/2009/12/11/salesforce-com-and-the-adobe-flash-platform-eseminar/</link>
		<comments>http://www.jamesward.com/2009/12/11/salesforce-com-and-the-adobe-flash-platform-eseminar/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 18:20:35 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flash Platform]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/?p=1411</guid>
		<description><![CDATA[On Thursday December 17th I&#8217;ll be doing an eSeminar about Salesforce.com and the Adobe Flash Platform. This is a great opportunity to learn more about how to build Flex RIAs on the Cloud using the new Flash Builder for Force.com tool. Sign up and see more details. Hope to see you there!]]></description>
			<content:encoded><![CDATA[<p>On Thursday December 17th I&#8217;ll be doing an eSeminar about Salesforce.com and the Adobe Flash Platform.  This is a great opportunity to learn more about how to build Flex RIAs on the Cloud using the new Flash Builder for Force.com tool.  <a href="http://www.adobe.com/cfusion/event/index.cfm?event=detail&#038;id=1489921&#038;loc=en_us">Sign up and see more details</a>.  Hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2009/12/11/salesforce-com-and-the-adobe-flash-platform-eseminar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex At Dreamforce 2009</title>
		<link>http://www.jamesward.com/2009/11/19/flex-at-dreamforce-2009/</link>
		<comments>http://www.jamesward.com/2009/11/19/flex-at-dreamforce-2009/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 16:51:17 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/blog/?p=1366</guid>
		<description><![CDATA[This week I&#8217;m in San Francisco at Dreamforce &#8211; Salesforce.com&#8217;s yearly conference. It&#8217;s amazing to walk around the expo hall and see how much Flex is being used in enterprise products and services. Like last year I&#8217;ve been recording some videos of some of the great enterprise Flex apps here. Also Greg Wilson has been [...]]]></description>
			<content:encoded><![CDATA[<p>This week I&#8217;m in San Francisco at Dreamforce &#8211; Salesforce.com&#8217;s yearly conference.  It&#8217;s amazing to walk around the expo hall and see how much Flex is being used in enterprise products and services.  Like <a href="http://www.jamesward.com/blog/?s=Dreamforce+2008">last year</a> I&#8217;ve been recording some videos of some of the great enterprise Flex apps here.  Also <a href="http://gregsramblings.com/">Greg Wilson</a> has <a href="http://twitter.com/gregorywilson">been tweeting</a> a few pics of some of these apps including <a href="http://www.jamesward.com/2010/01/13/right90s-super-sexy-enterprise-flex-ria/">right90 (update: now a video instead of a pic)</a> and <a href="http://twitpic.com/q16ak">PivotLink</a> with more to come.</p>
<p>Many of the Flex applications that people have built on top of Salesforce.com / Force.com today use <a href="http://developer.force.com/flextoolkit">the existing Flex Toolkit for Force.com</a>.  The new <a href="http://www.jamesward.com/blog/2009/10/26/adobe-and-salesforce-com-unite-ria-and-the-cloud/">Flash Builder for Force.com</a> tool today only supports desktop applications with Adobe AIR &#8211; but will also support web applications in the future.  But you can still use the existing Toolkit within Flash Builder for Force.com.  All you need to do is configure your project to use the Flex 3.4 SDK and add the force-flex.swc file to the project&#8217;s libs folder.  That&#8217;s it!</p>
<p>If you aren&#8217;t at Dreamforce and want to learn about the new Flash Builder for Force.com then check out <a href="http://salesforce.acrobat.com/p18708894/">the recording from a webinar</a> I co-presented a few weeks ago.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2009/11/19/flex-at-dreamforce-2009/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Adobe and Salesforce.com Unite RIA and The Cloud</title>
		<link>http://www.jamesward.com/2009/10/26/adobe-and-salesforce-com-unite-ria-and-the-cloud/</link>
		<comments>http://www.jamesward.com/2009/10/26/adobe-and-salesforce-com-unite-ria-and-the-cloud/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 16:17:03 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[LCDS]]></category>
		<category><![CDATA[RIA]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/blog/?p=1270</guid>
		<description><![CDATA[The two major trends transforming software right now are Rich Internet Applications (RIAs) and Cloud Computing / Software as a Service (SaaS or PaaS). These trends are driven by two needs: Full client capabilities, which allow software to perform optimally and increase usability Easy deployment, which allows developers to focus on business needs instead of [...]]]></description>
			<content:encoded><![CDATA[<p>The two major trends transforming software right now are Rich Internet Applications (RIAs) and Cloud Computing / Software as a Service (SaaS or PaaS).  These trends are driven by two needs:</p>
<ul>
<li>Full client capabilities, which allow software to perform optimally and increase usability
<li>
<li>Easy deployment, which allows developers to focus on business needs instead of building infrastructure</li>
</ul>
<p>The combination of RIA and Cloud is the future of software because it provides full client capabilities and easy deployment.  The chart below illustrates this in comparison to the other major software architectures (main-frame, client / server, and web).</p>
<p><img src="http://www.jamesward.com/blog/wp-content/uploads/2009/10/RIA.png" alt="RIA" title="RIA" width="600" height="370" class="alignnone size-full wp-image-1272" /></p>
<p>In line with these trends Adobe and Salesforce.com <a href="http://bit.ly/w29bL">announced today</a> that they are working together to unite Rich Internet Applications and The Cloud.  At the core of this announcement is a developer preview of the <a href="http://developer.force.com/flashbuilder">Adobe Flash Builder for Force.com</a> tool.  This tool enables developers to easily build intuitive user interfaces with Flex which connect to the Force.com cloud platform and Salesforce.com CRM data.  These applications can be deployed either in the browser or on the desktop using Adobe AIR.  When utilizing Adobe AIR, the applications can still function when users are disconnected.  Later, when users reconnect, the changes are synchronized with Force.com using the LiveCycle Data Services synchronization engine.</p>
<p>Being able to connect Flex applications to Salesforce.com / Force.com has been possible (and easy) since I co-created what was originally called the <a href="http://www.jamesward.com/blog/2007/04/17/the-open-source-flex-and-apollo-toolkit-for-salesforcecom/">Flex Toolkit for Apex</a>.  So while it has been possible to build Rich Cloud Applications for a few years, today&#8217;s announcement is significant for a few reasons:</p>
<ul>
<li>Adobe and Salesforce are now officially partnered together around Rich Cloud Applications</li>
<li>Much better, officially supported developer tooling</li>
<li>Much better offline data synchronization</li>
</ul>
<p>It&#8217;s really exciting to see how the vision of Rich Cloud Applications is becoming reality!</p>
<p>If you&#8217;d like to learn more or try out the new tooling check out these resources:</p>
<ul>
<li><a href="http://developer.force.com/flashbuilder">Get the developer preview and watch video demos</a></li>
<li><a href="http://www.adobe.com/devnet/salesforce/index.html?devcon=f1">Get inspired and see how it works</a></li>
<li><a href="http://www.youtube.com/watch?v=vUsC8sdJaE0">Watch a video walk-through</a></li>
</ul>
<p>Another great way to learn more is to sign up for a <a href="https://www.developerforce.com/events/flashbuilder_webinar/registration.php?d=70130000000EuzT">Webinar / Tech Talk</a> that I will be co-presenting.</p>
<p>Let me know what you think about this exciting new partnership and developer tooling.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2009/10/26/adobe-and-salesforce-com-unite-ria-and-the-cloud/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>Building Rich Cloud Applications with Force.com and Flex</title>
		<link>http://www.jamesward.com/2009/09/01/building-rich-cloud-applications-with-force-com-and-flex/</link>
		<comments>http://www.jamesward.com/2009/09/01/building-rich-cloud-applications-with-force-com-and-flex/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 02:00:59 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/blog/?p=1156</guid>
		<description><![CDATA[Combining the power of the cloud and the client allows developers to have the best of both worlds &#8211; easy deployment and full client capabilities. Salesforce.com&#8217;s cloud platform, called Force.com, and the Flash Platform are two proven and reliable choices for building these types of Rich Cloud Applications. Last week I co-hosted a webinar called [...]]]></description>
			<content:encoded><![CDATA[<p>Combining the power of the cloud and the client allows developers to have the best of both worlds &#8211; easy deployment and full client capabilities.  Salesforce.com&#8217;s cloud platform, called Force.com, and the Flash Platform are two proven and reliable choices for building these types of Rich Cloud Applications.  Last week I co-hosted a webinar called &#8220;Developing Rich User Interfaces on Force.com Using Adobe Flex&#8221; in which Ryan Marples (from Salesforce.com) and I walked through the two platforms and how to use them together to build great software.  If you didn&#8217;t have the chance to join the webinar then please go watch <a href="https://admin.acrobat.com/_a13852757/p23759608/">the recording</a> and let us know what you think.</p>
<p>In the webinar we didn&#8217;t have a chance to walk through all of the details of building Rich Cloud Applications with Force.com and Flex so here is a tutorial and the <a href="/demos/CarIncident.zip">source code</a> for the highly desired car insurance demo.</p>
<p><strong>Overview</strong></p>
<p>With Rich Cloud Applications the back-end and front-end are distinctly different pieces.  The first step when building these types of applications is to identify the domain model that will be used on the back-end for longterm persistence.  Force.com will take care of all the details around scalability, reliability, disaster recovery, constraints, security, etc.  All we need to do is describe the model in Force.com.  In this case the model is for a piece of the insurance demo I frequently do.  Here is a screenshot:</p>
<p><img src="http://www.jamesward.com/blog/wp-content/uploads/2009/09/insuricorp.jpg" alt="insuricorp" title="insuricorp" width="618" height="765" class="alignnone size-full wp-image-1166" /></p>
<p>The information we need to store for this demo is the coordinates of all four cars and the coordinates of the crash indicator.  In the next section we will describe that data model on Force.com.</p>
<p>Since the front-end will be built with Flex you will need either <a href="http://www.adobe.com/go/flex_trial">Flex Builder</a> (60 day trial available) or the <a href="http://opensource.adobe.com">open source Flex SDK</a>.  This tutorial will assume you are using Flex Builder.  Flex contains many out-of-the-box components but the car dragging UI used in the insurance demo is not one of them.  The section about building the front-end will walk through some of the Flex code used to create that UI.  If you want to learn more about creating custom components in Flex there is great documentation on the <a href="http://www.adobe.com/devnet/flex/components.html">Adobe Developer Connection</a>.  Also if you want to see the components that are available in Flex then check out <a href="http://flex.org/tour">Tour de Flex</a>.</p>
<p>Once the Flex application has been built, this tutorial will walk through the steps to put it up on the Force.com cloud.</p>
<p><strong>Setting up the Back-end</strong></p>
<p>To begin setting up the back-end on Force.com you will need a <a href="http://developer.force.com">developer account</a>.  Once logged in you can go into the Setup mode by clicking on the &#8220;Setup&#8221; link at the top of the page.  Setup mode is where you will configure the back-end data model on Force.com and deploy the Flex application after it&#8217;s built.  On the left side of the Setup page you will see a section titled App Setup and underneath that a link titled &#8220;Create&#8221;.  Click that link and then click the &#8220;Objects&#8221; link which will now appear in the list. This is where custom objects on Force.com are created and configured.</p>
<p>Add a new custom object titled &#8220;AccidentReport&#8221;.  Then on that object create a few custom fields:</p>
<ul>
<li>Date_of_Accident  &#8211;  The type is Date.  This field will store the date the accident happened.</li>
<li>IncidentX  &#8211;  The type is Number.  This field will store the X coordinate of the crash indicator.</li>
<li>IncidentY  &#8211;  The type is Number.  This field will store the Y coordinate of the crash indicator.</li>
</ul>
<p>Next create another custom object titled &#8220;IncidentCar&#8221;.  On that object create these custom fields:</p>
<ul>
<li>StartX  &#8211;  The type is Number.  This field will store the X coordinate of the starting car&#8217;s position.</li>
<li>StartY  &#8211;  The type is Number.  This field will store the Y coordinate of the starting car&#8217;s position.</li>
<li>EndX  &#8211;  The type is Number.  This field will store the X coordinate of the ending car&#8217;s position.</li>
<li>EndY  &#8211;  The type is Number.  This field will store the Y coordinate of the ending car&#8217;s position.</li>
<li>AccidentReport  &#8211;  This is a Master-Detail Relationship where the relationship is to the AccidentReport.</li>
</ul>
<p>The data model has now been configured on Force.com and is ready for use.  You may want to add a few fake records (an AccidentReport with two cars) manually to test the data model.</p>
<p><strong>Building the Flex Client</strong></p>
<p>Now that the Force.com back-end is configured we can begin building the Flex client.  The client can run in three ways:</p>
<ol>
<li>Embedded in a Force.com page</li>
<li>On your own server</li>
<li>As a desktop application using Adobe AIR</li>
</ol>
<p>In this tutorial we will use option 1.  The details for deploying the application will be covered in the next section.</p>
<p>In order to connect to Force.com we need to download the <a href="http://developer.force.com/flextoolkit">Force.com Toolkit for Adobe AIR and Flex</a>.</p>
<p>Start by creating a new Flex Project in Flex Builder.  Then copy the force-flex.swc file from the Toolkit into the project&#8217;s libs folder.  In your application start with something simple like:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span> xmlns:salesforce=<span style="color: #ff0000;">&quot;http://www.salesforce.com/&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
  <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">    import com.salesforce.AsyncResponder;</span>
<span style="color: #339933;">    import com.salesforce.objects.LoginRequest;</span>
<span style="color: #339933;">    import com.salesforce.results.LoginResult;</span>
<span style="color: #339933;">    import com.salesforce.results.QueryResult;</span>
<span style="color: #339933;">  &lt;/mx:Script&gt;</span>
&nbsp;
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:applicationComplete</span><span style="color: #7400FF;">&gt;</span></span>
    var lr:LoginRequest = new LoginRequest();
      lr.username = &quot;YOUR USER NAME&quot;;
      lr.password = &quot;YOUR PASSWORD&quot;;
      lr.callback = new AsyncResponder(
        function(result:LoginResult):void {
          conn.query(&quot;Select Id, IncidentX__c, IncidentY__c, Date_of_Accident__c from AccidentReport__c&quot;,
            new AsyncResponder(function(result:QueryResult):void {
              dg.dataProvider = result.records;
            }));
      });
      conn.login(lr);
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:applicationComplete</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;salesforce:Connection</span> id=<span style="color: #ff0000;">&quot;conn&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
  <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:DataGrid</span> id=<span style="color: #ff0000;">&quot;dg&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Give it a try by running the application.  This simply logs in, fetches the AccidentReports and displays them in a DataGrid.  Make sure that you have some sample data on Force.com before you run this.  Otherwise you will get an error.  That is a simple read-only view of some data on the Force.com cloud!  However the full Car Incident application requires quite a bit more code.  You can <a href="/demos/CarIncident.zip">download the code</a> and then copy and paste the files into your project.</p>
<p>Let&#8217;s walk through the application requirements:</p>
<ol>
<li>Retrieve a list of AccidentReports</li>
<li>Allow the user to select an AccidentReport</li>
<li>Retrieve the IncidentCars for the selected AccidentReport</li>
<li>Allow the user to create a new AccidentReport</li>
<li>Allow the user to position the crash indicator and cars in the AccidentReport</li>
<li>Save the changes to Force.com</li>
</ol>
<p>When we started building our back-end we modeled the data in Force.com.  Now we need a client-side model of the data.  The two value objects for this purpose are AccidentReport.as and Car.as.  Those two value objects contains public properties corresponding to the values we need to hold once we get data back from Force.com.  They also have a constructor that can map the data format from Force.com to the value object&#8217;s properties.  For instance the Car value object&#8217;s constructor does the following:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">    <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> Car<span style="color: #66cc66;">&#40;</span>o:<span style="color: #0066CC;">Object</span>=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#123;</span>
      <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>o <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#123;</span>
        id = o.<span style="color: #006600;">Id</span>;
        startX = o.<span style="color: #006600;">StartX__c</span>;
        startY = o.<span style="color: #006600;">StartY__c</span>;
        endX = o.<span style="color: #006600;">EndX__c</span>;
        endY = o.<span style="color: #006600;">EndY__c</span>;
      <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>This simply sets the properties on an instance of Car to the data values retrieved from Force.com.  Later on you will see where those values come from and how we create new Car value objects.</p>
<p>Now that the client-side data model has been created we need a central place that will hold our value objects.  The easiest way to do this is to create a Singleton called Model.  You can find it in the Model.as class.  The model contains properties which store information about the current state of the Flex application.  In this case the state properties our application needs are:</p>
<ul>
<li>statusMessage:String  &#8211;  Holds messages related to server communication</li>
<li>loggedIn:Boolean  &#8211;  Specifies whether or not the user is logged in</li>
<li>accidentReports:ArrayCollection  &#8211;  Stores all of the AccidentReports that get fetched from the server</li>
<li>selectedAccidentReport:AccidentReport  &#8211;  The AccidentReport selected by the user (if any)</li>
</ul>
<p>Next we will setup a Controller that manages the communication to Force.com and updates the Model.  You can find the source code in the Controller.as class.  This class contains an instance of the Connection object from the Toolkit, which will actually do the communication to Force.com&#8217;s SOAP API.  It also contains a reference to the Singleton Model.  The controller exposes several public methods that support the requirements listed above.  These are:</p>
<ul>
<li>login(sessionId:String, serverUrl:String):void  &#8211;  A method that logs into Force.com based on the sessionId and serverUrl provided by the Force.com page.  Flex applications running outside of Force.com (on your own website or as a desktop application) will not have a sessionId so they will need to set the username and password instead.</li>
<li>getAccidentReports():void  &#8211;  Does a query for the AccidentReports owned by the authenticated user.</li>
<li>createAccidentReport():void  &#8211;  Creates a new AccidentReport.</li>
<li>getAccidentReport(accidentReport:AccidentReport):void  &#8211;  Fetches the IncidentCars for a given AccidentReport.</li>
<li>saveAccidentReport(accidentReport:AccidentReport):void  &#8211;  Updates an AccidentReport and its associated IncidentCars.</li>
</ul>
<p>All network requests in Flex happen asynchronously.  This means that all requests to Force.com also happen asynchronously; so while the methods listed above can make the request, other private functions are used to actually handle the server response and then update the Model.  For instance when the response from the query in getAccidentReports returns, the model is updated in the following way:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">    <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> getAccidentReportsResult<span style="color: #66cc66;">&#40;</span>qr:QueryResult<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span>
    <span style="color: #66cc66;">&#123;</span>
      model.<span style="color: #006600;">accidentReports</span> = <span style="color: #000000; font-weight: bold;">new</span> ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
      <span style="color: #808080; font-style: italic;">// store AccidentReports</span>
      <span style="color: #b1b100;">for</span> <span style="color: #b1b100;">each</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">var</span> o:<span style="color: #0066CC;">Object</span> <span style="color: #b1b100;">in</span> qr.<span style="color: #006600;">records</span><span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#123;</span>
        model.<span style="color: #006600;">accidentReports</span>.<span style="color: #006600;">addItem</span><span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">new</span> AccidentReport<span style="color: #66cc66;">&#40;</span>o<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
      <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span></pre></div></div>

<p>Notice that the records returned from the server are typed as Objects.  In the for loop we use the mapping in AccidentReport&#8217;s constructor to convert the Object to a typed AccidentReport.</p>
<p>Now that the Model and Controller are setup the next task is to build the UI.  The UI is built with a number of components:</p>
<ul>
<li>CarShape.as  &#8211;  A class that draws a single car.</li>
<li>DraggableCars.as  &#8211;  Has two CarShapes and draws a curved line between them.  Also has a Car value object which is used to position the CarShapes.  When the user drags a CarShape the underlying Car is updated.</li>
<li>Accident.mxml  &#8211;  Has an AccidentReport value object, two DraggableCars, and a crash indicator.  The cars stored on the AccidentReport are passed to the DraggableCars.  When the crash indicator is moved the AccidentReport value object is updated.</li>
<li>AccidentReportView.mxml  &#8211;  Contains the Controller, a DataGrid that displays the list of all AccidentReports, an Accident that is displayed when the user selects an item in the DataGrid, and buttons that allow the user to create, save, or close an AccidentReport.</li>
<li>CarIncident.mxml  &#8211;  The main application that contains an AccidentReportView and does the login when the application loads.</li>
</ul>
<p>Describing how the custom UI components work is beyond the scope of this article.  However it&#8217;s important to describe how the Model, View, and Controller interact.  In the AccidentReportView the Accident uses data binding to setup an observer on the model.  When the observer observes a change it lets the view know so that it can refresh its view of the model.  The instance of the Accident uses data binding for two things:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;"><span style="color: #7400FF;">&lt;cars:Accident</span> id=<span style="color: #ff0000;">&quot;accident&quot;</span> accidentReport=<span style="color: #ff0000;">&quot;{Model.getInstance().selectedAccidentReport}&quot;</span> visible=<span style="color: #ff0000;">&quot;{Model.getInstance().selectedAccidentReport != null}&quot;</span><span style="color: #7400FF;">/&gt;</span></span></pre></div></div>

<p>First the accidentReport value object of the Accident is set to data bind to the Model&#8217;s selectedAccidentReport.  When that value changes the data binding observer will notify the Accident about the change.  Second, the Accident is only visible when the Model&#8217;s selectedAccidentReport is not null.</p>
<p>The AccidentReportView also interacts with the controller by calling its public methods.  Here&#8217;s an example:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;">        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;Save&quot;</span><span style="color: #7400FF;">&gt;</span></span>
          <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:click</span><span style="color: #7400FF;">&gt;</span></span>
            controller.saveAccidentReport(accident.accidentReport);
&nbsp;
            accidentReportDataGrid.selectedItem = null;
            Model.getInstance().selectedAccidentReport = null;
          <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:click</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Button</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>When the user clicks the save button, the event handler calls the Controller&#8217;s saveAccidentReport method passing it the currently selected AccidentReport.  Since the components internally have made changes to the AccidentReport those changes are then propagated to Force.com by calling the Connection&#8217;s update method.  The save button&#8217;s event handler also deselects the currently selected item in the DataGrid and sets the selectedAccidentReport on the Model to null.</p>
<p>Now that you have a fully functional Rich Cloud Application built with Force.com and Flex the next step is to make that application available on the cloud.</p>
<p><strong>Deploying the Flex Client</strong></p>
<p>When in the development phase it may be convenient to hard code your username and password into the application like we did in the simple example above.  However, you should never do that in a production application.  If you are deploying on a Force.com page then you can use the session_id.  Here is an example:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript" style="font-family:monospace;">      conn.<span style="color: #006600;">serverUrl</span> = parameters.<span style="color: #006600;">server_url</span>;
&nbsp;
      <span style="color: #000000; font-weight: bold;">var</span> lr:LoginRequest = <span style="color: #000000; font-weight: bold;">new</span> LoginRequest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
      lr.<span style="color: #006600;">session_id</span> = parameters.<span style="color: #006600;">session_id</span>;
      lr.<span style="color: #006600;">server_url</span> = parameters.<span style="color: #006600;">server_url</span>;
      lr.<span style="color: #006600;">callback</span> = <span style="color: #000000; font-weight: bold;">new</span> AsyncResponder<span style="color: #66cc66;">&#40;</span>loginResult, loginFault<span style="color: #66cc66;">&#41;</span>;
      conn.<span style="color: #006600;">login</span><span style="color: #66cc66;">&#40;</span>lr<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>The parameters are available on the main Application and are passed into the application using the apex:flash VisualForce tag, which we will setup later.</p>
<p>Once your application is set up to use the session_id then you will need to create a release build of the Flex project.  To do that follow the Export -> Flex -> Release Build wizard.  This will create a smaller SWF file (the application) that will later be uploaded to Force.com.</p>
<p>To deploy the application go into the Force.com Setup mode, click on Develop under App Setup, and then click on Static Resources.  Create a new resource called &#8220;CarIncident&#8221; and upload the application&#8217;s SWF file found in the bin-release folder under the project.  Then under Develop, click Pages and add a new Page called &#8220;AccidentReport&#8221;.  Put the following code in the page:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;apex:page</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;apex:pageBlock</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;apex:flash</span> <span style="color: #000066;">src</span>=<span style="color: #ff0000;">&quot;{!$Resource.CarIncident}&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;500&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;500&quot;</span> <span style="color: #000066;">flashvars</span>=<span style="color: #ff0000;">&quot;session_id={!$Api.Session_ID}&amp;server_url={!$Api.Partner_Server_URL_150}&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/apex:pageBlock<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/apex:page<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Save the page and then you should be able to access it by going to:<br />
<a href="https://na1.salesforce.com/apex/AccidentReport">https://na1.salesforce.com/apex/AccidentReport</a></p>
<p>If my instructions are accurate then hopefully you will now see the CarIncident application on the cloud pulling data from Force.com like this screenshot:<br />
<img src="http://www.jamesward.com/blog/wp-content/uploads/2009/09/carincident.jpg" alt="carincident" title="carincident" width="800" height="844" class="alignnone size-full wp-image-1178" /></p>
<p>This is just a basic walk through of how to build Rich Cloud Applications with Force.com and Flex.  There are tons of additional features and configuration changes you can make on both the back-end and front-end.  But hopefully this helps you get started building Rich Cloud Applications with Force.com and Flex.  Let me know how it goes!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2009/09/01/building-rich-cloud-applications-with-force-com-and-flex/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Webinar: Developing Rich User Interfaces on Force.com Using Adobe Flex</title>
		<link>http://www.jamesward.com/2009/07/26/webinar-developing-rich-user-interfaces-on-force-com-using-adobe-flex/</link>
		<comments>http://www.jamesward.com/2009/07/26/webinar-developing-rich-user-interfaces-on-force-com-using-adobe-flex/#comments</comments>
		<pubDate>Sun, 26 Jul 2009 10:27:52 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/blog/?p=1083</guid>
		<description><![CDATA[On August 27 I&#8217;ll be co-presenting a webinar &#8211; Developing Rich User Interfaces on Force.com Using Adobe Flex. This will be a great opportunity to learn more about combining Cloud and RIA to create software that works well for end users and significantly reduces IT costs. If this interests you then go sign-up now. Hope [...]]]></description>
			<content:encoded><![CDATA[<p>On August 27 I&#8217;ll be co-presenting a webinar &#8211; <a href="https://www.developerforce.com/events/techtalk_arch_app_air_flex_webinar/registration.php?d=70130000000EqU8">Developing Rich User Interfaces on Force.com Using Adobe Flex</a>.  This will be a great opportunity to learn more about combining Cloud and RIA to create software that works well for end users and significantly reduces IT costs.  If this interests you then <a href="https://www.developerforce.com/events/techtalk_arch_app_air_flex_webinar/registration.php?d=70130000000EqU8">go sign-up now</a>.  Hope to &#8220;see&#8221; you on August 27th.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2009/07/26/webinar-developing-rich-user-interfaces-on-force-com-using-adobe-flex/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Flex and Salesforce / Force.com Updates</title>
		<link>http://www.jamesward.com/2009/06/22/flex-and-salesforce-force-com-updates/</link>
		<comments>http://www.jamesward.com/2009/06/22/flex-and-salesforce-force-com-updates/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 21:37:04 +0000</pubDate>
		<dc:creator>James Ward</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.jamesward.com/blog/?p=1013</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>There have been a lot of exciting things happening with Flex and Salesforce / Force.com lately.  First Ryan Marples recently <a href="http://blog.sforce.com/sforce/2009/05/an-update-to-the-forcecom-toolkit-for-adobe-flex-and-air.html">announced</a> the release of an updated version of the <a href="http://wiki.developerforce.com/index.php/Flex_Toolkit">Force.com Toolkit for Adobe AIR and Flex</a>.  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.</p>
<p>Today Adobe updated the Adobe Developer Connection&#8217;s page containing information about <a href="http://www.adobe.com/devnet/salesforce/">integrating Flex and Salesforce / Force.com</a>.  This new page contains new videos, demos, articles, and other great content.  Check it out and let us know what you think.</p>
<p>We are looking for people interested in authoring articles (either technical or decision maker focused) about integrating Flex and Salesforce / Force.com.  Please email me if you are interested: jaward at adobe dot com</p>
]]></content:encoded>
			<wfw:commentRss>http://www.jamesward.com/2009/06/22/flex-and-salesforce-force-com-updates/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
