1 Reply Latest reply on Oct 12, 2011 4:18 PM by kglad

    Draggable Progress Bar for swf - as2

    webpoppynet

      Hi there,

       

      I need to add a progress bar/playback controls for a presentation built in AS 2.0 which has such length voice over in it we've decided we need to give the user the ability to see where they are in the timeline and scrub through sections of the presentation. I'm familiar with stop and pause button code in situations like this, but it's the first time I've needed this kind of functionality. Presently, the first part of my project is set up with several scenes and is completely linear. The second section is interactive with swfs loaded into empty movieclips.

       

      I've found a number of references to progress bars online, but they're all for loading content, not for navigating once content is downloaded.

       

      Thanks so much in advance,

      Susan

        • 1. Re: Draggable Progress Bar for swf - as2
          kglad Adobe Community Professional & MVP

          determine the two extremes of your progress bar, say xLow and xHigh, though you could use a vertical scrollbar, too and use y values.  you can then use:

           

          var tl:MovieClip=this;

          parameterF(yourdragbar_mc,xLow,1,xHigh,tl._totalframes);

           

          yourdragbar_mc.onPress=function(){

          this.startDrag(false,xLow,this._y,xHight,this._y);

          this.onEnterFrame=scrollF;

          }

          yourdragbar_mc.onRelease=function(){

          this.stopDrag();

          delete this.onEnterFrame;

          }

           

          function scrollF():Void{

          tl.gotoAndStop(Math.round(this.m*this._x+this.b));

          }

           

          function parameterF(mc:MovieClip,x1:Number,y1:Number,x2:Number,y2:Number):Void{

          mc.m = (y1-y2)/(x1-x2);

          mc.b=y1-mc.m*x1;

          }

          1 person found this helpful