1 Reply Latest reply on Apr 16, 2007 8:03 AM by kglad

    sliding volume control

    x_y_z
      Hi,
      Can anyone help me? I want to create a sliding volume control through action scripting. Control should be the same as we have in Windows Media Player. When I drag to the left, the volumme should decrease and when draged to thr right, the volume should increase.

      Saxena
        • 1. Re: sliding volume control
          kglad Adobe Community Professional & MVP
          the exact coding depends upon the registration point of your scrubber or slider and whether your control is vertical or horizontal.

          if the slider has its reg point at the left and is horizontal, start a loop with your onPress (and startDrag() ), and set the volume of the sound you want to control according to the position of the slider.

          you'll want the volume to be zero when the slider's _x property is zero and you'll want the volume to be 100 when the slider's _x property is the controls._width-sliders._width.

          this gives two equations in two unknowns. solve for the unknowns and you have your equation to give the volume for any slider position:

          vol=sliders._x*100/(controls._width-sliders._width);
          s.setVolume(vol);