Extending Flex with Flash

While a large Flex application is loaded, the user may experience unpleasant delays, which can be used productively to logon to this application. Besides, it’ll give the user perception that your application loads faster.

I recently had a chance to use Ted Patrick’s (Adobe) sample to mitigate the load time of the application. While Ted is displaying a splash screen while the application is loaded and initialized in the background, I wanted to use a very dull logon window to keep the user occupied with a bit more useful stuff. Here are 3 challenges you would face with that task:

1. The logon screen has to be very lightweight – under 10K – so it may not be based on the Flex framework

2. The application may not remove logon window on load as the user has to login first.

3. If the user completes his/her login but the application did not finish its load, the standard progress bar has to appear.

Confronted with all these problems I timidly thought of writing a small HTML/JavaScript dialog and calling it from Flex, but overcame those thoughts and did the only right thing to do – called for help from Konstantin – our Flex AND Flash developer and he has created LightweightPreloader.zip

Inside of this zip file you’ll find a simple login window with a typical user and password fields over a plain screen that sends the login info to the server and expects some XML back. It also includes Ant build files and support classes. After you are done deploying you should get a small (<6K) SWF login window (4K accounts for buttons and the window background, the rest is actual code). The lesson learned: there is a large class of tasks that can only be solved using native Flash APIs and coding techniques. In the last year I came across at least 6 cases when the native Flash code was the only reasonable way to go. I believe it is time for Flex and Flash developers to start working on common shared libraries covering the "non-visual" domain. For additional info on what's happening while the Flex application is loaded, refer to this article.

3 thoughts on “Extending Flex with Flash

  1. Using of lightweight login form to occupy user while loading big application is very smart idea. I like such kind of tricks. In my last flash application (since then I’ve switched to flex), I’ve reached the almost absurd size of the first frame in nearly 300 bytes (just rounded rectangle) and then 4-kbytes preloader had been added at the second frame. This ensures that application appears immediately to user. Then I’ve added a simple quick tips component — lightweight too, to attract user with info on application usage (8 tips).

    I think there’s should be no preloaders at all. Each application development schedule should include such task of a project as a implementation of application loading teaser — and this is creative task.

    Very useful post, thank you.

  2. This is a great preloader, I’ve adopted it for many of my projects. One thing I’ve just come across but have been avoiding is “logout” functionality. is there an easy way to get back to the preloading screen and have it use all the same logic? I’ll find a way to do this on my own but I just thought I’d check and get a chance to say: thanks for the great idea and code!

Comments are closed.