3 Replies Latest reply on Dec 17, 2008 1:43 PM by r_josh4u

    Progress Bar

    koolhoney1
      Hi All,

      I am new to flex.

      I am trying to down load an image. while loading the image, i have to show progress bar to user. But i am getting both at a time.
      My intention is first progress bar to show the downloading progress then image has to display.

      my code is


      <?xml version="1.0"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml">

      <mx:Script>
      <![CDATA[
      public function initImage():void {
      image1.load('E:/gr/Airtel Bill Pay.JPG');
      }
      ]]>
      </mx:Script>

      <mx:VBox id="vbox0" width="600" height="600">
      <mx:Canvas>
      <mx:ProgressBar width="200" source="image1"/>
      </mx:Canvas>
      <mx:Button id="myButton" label="Show" click="initImage();"/>
      <mx:Image height="600" width="600" id="image1" autoLoad="false" visible="true"/>
      </mx:VBox>
      </mx:Application>




      Please give some solution.

      Thanks in Adv.
        • 1. Re: Progress Bar
          atta707 Level 2
          set the visible property of the progress to false by default and on the complete event set to false again:

          <mx:ProgressBar id="pb" width="200" source="image1"
          visible="false" complete="pb.visible=false"/>

          so when do you show it?
          private function initImage() : void {
          pb.visible = true;
          image1.load("big_bg.jpg");

          }

          ATTA
          • 2. Re: Progress Bar
            koolhoney1 Level 1
            Thanks for reply.

            My requirement is: the image is down loading still in process........... in that time progressbar has to show the % of downloading. only the completion of 100 % the image has to display.

            with my present code the progress bar directly showing 100% and the image is displaying.

            Please help me.
            • 3. Re: Progress Bar
              r_josh4u

              Try using the mode="polled" in the ProgressBar.


              <mx:ProgressBar width="300" source="image1" mode="polled"
              label="Loading Image %1 out of %2 bytes, %3%%" labelWidth="400"/>