1 Reply Latest reply on Aug 25, 2006 4:46 PM by WebXperience

    Action script and the slider bar

      Greetings to all the Flash Gods who are kind enough to read this…

      I have a flash movie and it has a slider bar which Horz. Scrolls through some images..

      The issue is on the last image it slides all the way to the left where as I would like it to stop dead on the image (no white space) I went through the actionscript but could not see a bit that allows me to control just how far left it scrolls through the image.

      The sample is here http://www.maverickartist.com/test/

      I think you for reading this and for any insight you may provide.

        • 1. Re: Action script and the slider bar
          WebXperience Level 1
          It looks like you set the parameters for your startDrag() function to the width of the pictures instead of to the width of your viewing screen. The syntax looks like this:

          startDrag(target:Object, [lock:Boolean, left:Number, top:Number, right:Number, bottom:Number]);

          The lock:Boolean parameter is optional is A Boolean value specifying whether the draggable movie clip is locked to the center of the mouse position (true ) or locked to the point where the user first clicked the movie clip (false ). Judging by the way your slider is set up you would probably want to set this to true.

          In your slider, since your only moving horizontally along the x line, your l eft:number would be equal to the beginning postion of the parent MovieClip that you are trying to move along. In this case the grey bar above your pictures (which right now seems to have no limit.) You will need to limit the width of the drag. The right:number would be where you place this width number. The top:Number & bottom:Number would beequal to this._y since the slider will only be moving along the x line.

          So, if you had a slider bar that measured 200 px in width, your startDrag function might look something like this:

          this.startDrag(true, 0, this._y, 200, this._y);

          Then you'd have to have your picture MovieClip move proportionally with the sliders movement, like:

          (slider._x/200) * (width of your pictures)