The Power of the ProgressBar



When developing RIAs it’s generally best practice to provide the user with feedback when data is loading. If you’re familiar with Flash MX Pro 2004 then you’ve most likely seen the ProgressBar component. I wanted to take a minute and demonstrate a simple example of using the ProgressBar component that ships with Flex. There are different flavors of the component and I’m going to discuss the simplest implementation.

The example below is considered a “determinate” ProgressBar. This means that we’re loading data or a file of a fixed size. We don’t always know the size of the request so we’ll address that later. This example demonstrates loading a 190kB jpg where the progress bar compares the number of getBytesLoaded() with the number of getBytesTotal() and displays the percentage loaded. The basic code to produce the example below looks like:

Click the load button below to see it in action.



Comments are closed.