1 Reply Latest reply on Jun 14, 2006 10:07 AM by kglad

    Volume Slider Help Needed

      I have a banner with a background sound that reloads every time a visitor goes to a new page. The sound level is controlled by a volume slider that I built using this tutorial and now I want to save the position of the slider as a cookie. I think I need to use a SharedObject but am struggling to use it properly! This is where I have got to:

      //attach and play sound
      mySound = new Sound(this);
      mySound.setVolume(50);//stops sound 'clipping' on start

      var mySO:SharedObject = SharedObject.getLocal("mySoundCookie");

      //uncomment the next 2 lines when testing
      //delete mySO.data.myPoint;

      //check for existing data
      if (mySO.data.myPoint != undefined || !mySO.data.myPoint){
      //set starting volume
      slider.bar._y = -50;
      //set volume of sound to y position
      slider.bar.onEnterFrame = function() {

      //constrain dragging to the slider
      slider.bar.onPress = function() {
      startDrag(this, false, this._x, -65, this._x, 0);
      slider.bar.onRelease = slider.bar.onReleaseOutside = function() {

      //store position of bar as a variable
      var myPoint = new Object();
      myPoint = slider.bar._y;


      //create sound cookie
      mySO = SharedObject.getLocal("mySoundCookie");
      mySO.data.obj = myPoint;

      I have tried following SharedObject tutorials and the Flash Help files but am failing to grasp how to use them, so would be very grateful if someone could help me fix this script.

      Many thanks.