3 Replies Latest reply on Jun 18, 2008 9:43 AM by crazyjoemilan

    Help with ProgressBar Component

    larsnorrbrand
      Hello,
      I hope that some one can help me, I like to create a thermometer or 0-100% scale, the progressbar should show a value entered in a dynamic text box (value input to the value in the scale). (action script 2.., can anyone explain the required AS2 code or have an example?)

      All help very much appreciated /thanks
      -Larsa
        • 1. Re: Help with ProgressBar Component
          crazyjoemilan Level 2
          there are a few ways to do this effectively.

          Are you comfortable with writing code, or do you prefer to use the timeline? (you'll still need to write code, but less with a timeline/logic loop)

          What I usually use is the "setInterval" to call the same function over and over. That function checks for the bytesLoaded vs. bytesTotal, and modifies the textField, as well as my MovieClip on the stage (in your case the thermometer).

          Does that make sense?
          • 2. Re: Help with ProgressBar Component
            larsnorrbrand Level 1
            Hello, well -no i am more of an "animation/timeline guy" can you post some code to more visualy describe what you mean. If i understand you correctly i will try to get a value from the dynamic textbox (checking it for change of value (loop)) and setting the progressbar value to that value (bytesLoaded vs 100% scale (bytesTotal) ?

            Br/thanks
            -Larsa
            • 3. Re: Help with ProgressBar Component
              crazyjoemilan Level 2
              No worries, there is a timeline loop that is a little more logical for visual people.

              we'll be checking the bytesLoaded against bytesTotal, and that will give us our % to give to the dynamic textbox, then we'll set our height property against that %. Make sense? ....

              make a new movieclip on the timeline.
              give it four frames.
              on frame one, we'll get bytes total

              //frame 1 code
              bt = _root.bytesTotal

              //frame 2 code
              bl = _root.bytesLoaded

              //frame 3 code
              trace(bl/bt + " %);
              if (bl == bt) {
              this.gotoAndStop(4);
              } else {
              this.gotoAndPlay(2);
              }

              //frame 4 code
              trace("if you see this traced in the window, it means your movie is loaded completely");


              ////////////////////////////
              try that out and see what you can make of it. remember if it all just happens instantly, you'll need to force it to slow down the loading (using the "download settings")