Preloading a NeoSwiff Application

| No Comments | No TrackBacks

If you've ever wondered how to preload a NeoSwiff WinForms application, this article is for you.

Unlike Flex, when you build an application in NeoSwiff there is no download progress indicator automatically inserted for you. Thus, if your application .swf file runs 150K in size, your users will see a blank screen until the download completes and the application can be interacted with. This could potentially be a long time waiting without feedback, especially on slower connections, and isn't good for usability.

The solution is to create a preloader. The preloader needs to be small in size so that it downloads quickly to present the user with feedback as fast as possible. The application .swf downloads in the background, and the preloader displays the download progress. Once the application is fully downloaded, the preloader hands over control to the application.

In the samples that ship with NeoSwiff, a basic preloader is one of them. I've extended the functionality of the sample in two ways. First, I've made the preloader dynamic, meaning you can load in any .swf without having to re-compile and hard-code the url (as in the sample). Second, I've made the preloader automatically adjust its layout so that any time the browser is resized the preloader adjusts itself accordingly (and thus there isn't a hard-coded width and height).

You can download my NeoSwiff Preloader here. Source code is included in the download, licensed under the MIT license. Portions of the code were contributed by GlobFX, used with permission.

To see the preloader in action, check out this page.

Instructions for use are included in the download, but essentially all you need to do is replace the FlashVars (in both the object and embed tags) in the preloader.html file. Replace the title variable with the title of your application, and replace the url variable with the path to your .swf file.

The preloader ended up being around 7k when all was said and done, so it will load quickly when the .html page is visited. Your application .swf will download in the background and the preloader reports the download progress, then transfers control to the application .swf once the download completes.

Enjoy!

No TrackBacks

TrackBack URL: http://www.darronschall.com/mt/mt-tb.cgi/86

Leave a comment



About this Entry

This page contains a single entry by darron published on January 27, 2006 9:37 AM.

Spanky Makes the Rounds was the previous entry in this blog.

O'Reilly Schwag is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Archives

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.02