1 Reply Latest reply on Aug 16, 2010 10:56 PM by BhaskerChari

    How to fill up the Flex ProgressBar control ,depending upon the Controls Seelcted inside the MXML

    kiran7881 Level 1

      Hi ,

       

      Please , let me know  How to fill up the Flex ProgressBar control ,depending upon the Controls Seelcted inside the MXML

       


      Lets say I have five text boxes and a dropdown box in my flex application, how can I make the progress bar fill up when there is text in each box, and the dropdown selected.

       

      Please help
      Thanks in advance .
        • 1. Re: How to fill up the Flex ProgressBar control ,depending upon the Controls Seelcted inside the MXML
          BhaskerChari Level 4

          Hi Kiran,

           

          You can do something like below to implement the functionlaity you needed...

           

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="top"
              horizontalAlign="center" backgroundGradientColors="[0x000000,0x323232]" paddingTop="0" viewSourceURL="srcview/index.html">
             
              <mx:Script>
                  <![CDATA[
                    
                    private var j:uint=0;
                   
                    // Event handler function to set the value of the
                    // ProgressBar control.
                    private function runit():void
                    {
                        if(j<=100)
                        {
                          j+=10;
                           bar.setProgress(j,100);
                           bar.label= "CurrentProgress" + " " + j + "%";
                        }
                        if(j>100)
                        {
                           j=0;
                           check1.selected=false;
                           bar.setProgress(j,100);
                           bar.label= "CurrentProgress" + " " + j + "%";
                        }
                    }
                    private function checkFunction():void
                    {          
                     if(!check1.selected)
                     {           
                       if(j<=100)
                        {
                          j-=10;
                           bar.setProgress(j,100);
                           bar.label= "CurrentProgress" + " " + j + "%";                
                        }
                        if(j>100)
                        {
                           j=0;
                           check1.selected=false;
                           bar.setProgress(j,100);
                           bar.label= "CurrentProgress" + " " + j + "%";
                        }
                     }
                      else
                      {
                     runit();
                     } 
                    }
                  ]]>   
              </mx:Script>
             
              <mx:Panel title="ProgressBar Control" layout="vertical" color="0xffffff" borderAlpha="0.15"
                   paddingTop="10" paddingRight="10" paddingBottom="10" paddingLeft="10" horizontalAlign="center">
                  
                   <mx:Label width="100%" color="0x323232"
                      text="Click the button to increment the progress bar." />
                      <mx:HBox>
                      
                    <mx:CheckBox id="check1" label="Check Me" color="#123456" click="checkFunction();"/> 
                  <mx:Button id="Speed" label="Click" click="runit();" color="0x323232"/>
                    </mx:HBox>
                     
                  <mx:ProgressBar id="bar" labelPlacement="bottom" themeColor="#EE1122" minimum="0" visible="true" maximum="100"
                       color="0x323232"    label="CurrentProgress 0%" direction="right" mode="manual" width="100%"/>
                   
              </mx:Panel>
          </mx:Application>

           

          If this post answers your question or helps, please kindly mark it as such.


          Thanks,

          Bhasker Chari