5 Replies Latest reply on Dec 12, 2006 3:28 PM by Newsgroup_User

    Need help with creating a seek bar or time slider

    Time Indicator Level 1
      Hi!

      I have three scenes in my fla and I want to create a time slider that shows the current frame time playing and the total frame time. Can anyone help me on that.

      Thanks
        • 1. Re: Need help with creating a seek bar or time slider
          Level 7
          Put the script below in the first frame of the first scene.

          //creates the textfield
          this.createTextField("txtFrameStatus", this.getNextHighestDepth(), 0, 0,
          500, 0);
          this.txtFrameStatus.multiline = true;
          this.txtFrameStatus.wordWrap = true;
          this.txtFrameStatus.html = true;
          this.txtFrameStatus.autoSize = true;


          //function that shows the information
          this.onEnterFrame = function():Void{
          txtFrameStatus.htmlText = "Total Frames: " + _totalframes + "<br>";
          txtFrameStatus.htmlText += "Current Frame: " + _currentframe + "<br>";
          txtFrameStatus.htmlText += "Porcent: " + Math.floor((_currentframe /
          _totalframes) * 100) + "%";
          };


          --
          Regards,
          Erick Souza
          www.ericksouza.com
          • 2. Re: Need help with creating a seek bar or time slider
            Time Indicator Level 1
            Hi Erick,

            Thanks so much.. but I have a quick question... if i were to convert to time, how would i do that. I created a slider bar and a handle, I just need that to show visually. How would do i that. In other words, I want to convert it into minutes and second with a slider bar and a pointer showing where are they are in the movie.
            • 3. Re: Need help with creating a seek bar or time slider
              Level 7
              I made some modifications..

              Creates:
              txtFrameStatus
              textfield: html and multiline.

              mcBar
              A mc with a horizontal bar.


              //vars
              var movieFPS:Number = 12; //set FPS here
              var porcent:Number;
              var currentFrame:Number;
              var totalFrames:Number;
              var totalSeconds:Number;
              var currentSeconds:Number;
              var textTime:String;

              //function that shows the information
              this.onEnterFrame = function():Void{
              currentFrame = _currentframe;
              totalFrames = _totalframes;
              porcent = Math.floor((currentFrame / totalFrames) * 100);
              totalSeconds = Math.floor(totalFrames / 12);
              currentSeconds = Math.floor(currentFrame / 12);

              var cSeconds:Number = currentSeconds % 60; cSeconds = (cSeconds < 10) ?
              "0" + cSeconds : cSeconds;
              var cMinutes:Number = Math.floor(currentSeconds / 60); cMinutes =
              (cMinutes < 10) ? "0" + cMinutes : cMinutes;

              var tSeconds:Number = totalSeconds % 60; tSeconds = (tSeconds < 10) ?
              "0" + tSeconds : tSeconds;
              var tMinutes:Number = Math.floor(totalSeconds / 60); tMinutes =
              (tMinutes < 10) ? "0" + tMinutes : tMinutes;

              textTime = "Total Frames: " + totalFrames + "<br>";
              textTime += "Current Frame: " + currentFrame + "<br>";
              textTime += "Porcent: " + porcent + "%" + "<br>";
              textTime += "Total Time: " + tMinutes + " : " + tSeconds + "<br>";
              textTime += "Current Time: " + cMinutes + " : " + cSeconds;

              txtFrameStatus.htmlText = textTime;

              mcBar._xscale = porcent;

              if(porcent == 100) delete this.onEnterFrame;
              };


              --
              Regards,
              Erick Souza
              www.ericksouza.com
              • 4. Re: Need help with creating a seek bar or time slider
                Time Indicator Level 1
                Hi Erick,

                Thanks so much. It works.. I really appreciate your time and help on this. Once again, thank you so much
                • 5. Re: Need help with creating a seek bar or time slider
                  Level 7
                  You're welcome.

                  --
                  Regards,
                  Erick Souza
                  www.ericksouza.com