RIAs on the Web, on the Desktop, and in a PDF

Some believe that the “Internet” in “rich Internet application” (RIA) means that RIAs must only run in the browser. However my definition of RIA is not constrained to only web-based applications. RIAs can run anywhere: web, desktop, mobile devices, TVs, or even inside PDFs. Ideally we should have some level of code and library reusability between these environments. However to think that we can reuse the entire application is a pipe dream. Client capabilities and end user needs vary too greatly between these mediums.

I wanted to build an application in Flex that shows how applications can have a high degree of reuse between the web, the desktop, and in a PDF. I decided to build a Mortgage Calculator to illustrate this. Here is the web widget:

From within the web widget you can install the desktop widget or email yourself a PDF containing the widget. Since this application is a small, self contained application (i.e. a widget) the functionality between the different mediums is very similar. In this case I was able to reuse about 99% of the code between the different versions. However, sometimes achieving that level of reuse is not possible due to the differences in client capabilities and the end user needs. This is the case with the Flex and Adobe AIR based Oracle CRM Gadgets, which are for different use cases than the primary Siebel UI.

There are beginning to be more instances where RIA widgets are being reused across different mediums. But this is only one piece of software development. In other instances the capabilities and functionality of web, desktop, and mobile applications vary so greatly that there is little reuse. Either way it’s important to architect our back ends such that they are agnostic to the front end. This is one of the ways RIA and mobile app development have changed the way we build software. It’s a good thing and we should embrace it.

  • Valentin

    Very nice, James, thank you for sharing.
    Is this now already done with Flex 4 ? Any chance to have a look in the source code ?


  • james

    AIR widget or application are useful when we need to use almost everyday, I don’t see why your post is about a mortgage calculator and nothing to learn in your above article. I rather you build something more interesting.

  • Hi Valentin,

    This was done with Flex 3. The primary reason is that Adobe Reader only supports Flash Player 9. I haven’t release the source code for this one. Sorry.

    Hi james,

    This example certainly has a FSI slant to it where some people within these types of organizations do need to frequently use a Mortgage Calculator. I’m open to other ideas that would apply these same concepts to other use cases. Let me know if you can think of any.


  • Hi James,

    I agree with some of what you’ve said, however, in my opinion, the whole idea behind Adobe’s AIR Platform is to have a multiple operating system runtime that is the same, regardless of whether said runtime is installed as a browser plugin, for desktop, a mobile device, TV, Xbox 360, etc. As such, it’s only the visual aspect (GUI) of an application’s development cycle that needs to be altered depending on what kind of ‘machine’ the runtime exists on (by this I’m specifically infering to screen size and resolution). And with some extremely tight and well thought out development, you might not even need to look at the visual side of things seperately.

    Imagine that, an application that only has one source code repository and one build sequence yet can be deployed to any and every environment imaginable – a firefox browser on OSX, an opera browser in Vista, as an iPhone application, a Playstation 3, the screen on your local ATM, the display on your DVD Player, your web enabled TV, etc, etc, etc.

    I wonder if it will ever be like this?

  • Hi Stephen,

    I think that in some cases (primarily widgets) that will be possible. But for most applications I think we will see the experiences for each medium heavily customized for different user needs and client capabilities. Good examples of this are Google Maps and Facebook. The applications differ pretty drastically depending on the medium. And it’s a good thing. I really don’t want the full maps.google.com to be the experience I have on my mobile device. Unfortunately today these types of applications require using many different tools, platforms, programming languages, etc. Adobe AIR will certainly help to unify the tool chain to build applications that cross different mediums. But I don’t foresee many applications that will be 100% reusable across the different mediums. But some reuse and a standard tool chain is exactly what we are all hoping for.


  • Pingback: Digital Media Minute()

  • Don

    Can’t get the email to work:
    javax.mail.MessagingException: Could not connect to SMTP host: smtp.interdoodle.net, port: 25;
    nested exception is:
    java.net.NoRouteToHostException: No route to host

  • Don

    Can I get a swf version of this app to embed in a pdf sampler I am putting together? (full reference credit of course)

  • Hi Don,

    Thanks for letting me know about that. It’s been fixed.

    You can use the SWF from here:


  • Very cool…I also like that this could be run on iPhone with CS5. Being able to push app ouput/results from iPhone down to interactive PDF results in my inbox or even pushing it through an LC process and generating output from/through a workflow (while snowboarding in Tahoe) makes it pretty sexy.

  • Don

    Thanks James, the email pdf functions perfectly now. I tried using the swf version you linked to in my own pdf but I get a lot of errors:

    SecurityError: Error #2148: SWF file file:///E|/Flash%20Platform/SWFs/mortgageCalcWeb2.swf cannot access local resource file:///E|/Flash%20Platform/SWFs/framework_3.4.0.9271.swz. Only local-with-filesystem and trusted local SWF files may access local resources.
    at flash.net::URLStream/load()
    at flash.net::URLLoader/load()
    at mx.core::CrossDomainRSLItem/load()
    at mx.core::RSLListLoader/loadNext()
    at mx.core::RSLListLoader/load()
    at mx.preloaders::Preloader/initialize()
    at mx.managers::SystemManager/http://www.adobe.com/2006/flex/mx/internal::initialize()
    at mx.managers::SystemManager/initHandler()

  • Don,

    Try to turn off the Framework RSLs in the project properties -> library path.


  • Don

    Not sure I understood your comment about RSL – I don’t have any source files…

  • Ahh… I think that SWF uses RSLs. Try this one:


  • Don

    Thanks, works like a charm now (although i think the swf size doubled). Thanks again James.


  • Pingback: Portable RIAs – Flex Apps in PDFs()

  • Andrew Olton

    Hey man, love this app. This is yet another reason why I love flex. But I have a question, for business apps which is better Flex+Java or Flex+PHP?

    Considering: Learning times, developments time, Power etc.

    • Java is used more for business apps. But it’s really a matter of personal preference.

  • make

    Hi James,

    thanks for the great tutorials.

    Is it possible to embed a Flex application inside a PDF so that the Flex app could retrieve a background image from the web using HTTP? If not, is it possible to read PDF file attachments using the Flex app?