2 Replies Latest reply on Jan 27, 2010 10:39 AM by Flex harUI

    Creating a progress bar on a HTTP Service


      Hello All,


      As the top title suggests, does anyone know the best way of doing this? The HTTP service is simply pulling some XML data and I want to inform the user of how long this is going to take or what % it is currently completed.


      I dont have much experience with using progress bars so any help would be much appreciated.



        • 1. Re: Creating a progress bar on a HTTP Service
          MrFork Level 1

          I found this online but It doesnt seem to work;


          If your HTTPService has id of httpService you have to first invoke an eventListener of type ProgressEvent.PROGRESS. On the stage or in your Popup you have to make a progressBar with id (for example myProgressBar)

          httpService.addEventListener(ProgressEvent.PROGRES, progressFunction);

          Than you have define a progressFunction that will accept broadcasted ProgressEvent like so

          private function progressFunction(event:ProgressEvent):void{
          myProgressBar.mode = 'manual';
          myProgressBar.setProgress(event.bytesLoaded, event.bytesTotal);
          //you can than do something when content is loaded
          if (event.bytesLoaded == event.bytesTotal){
          //code for popup removal or removal of progressBar

          • 2. Re: Creating a progress bar on a HTTP Service
            Flex harUI Adobe Employee

            Keep in mind that there are essentially 3 phases to a server request: delay

            until the first byte arrives, delay while the rest of the bytes arrive,

            delay while the bytes are processed into the requires result format.  Only

            the second phase can be "monitored" with a progress bar, and hopefully you

            aren't requesting so much data that it needs to be monitored.