6 Replies Latest reply on Jan 25, 2007 9:16 AM by kglad

    Help with SharedObject Flash 8

    PlakaInc
      I am brand new to programming in flash, and have run into a problem. Oddly enough I had this script working right and decided to add some dynamic text and somehow broke it. Since then I have completely redid the swf from start to finish but still can't get the sharedobject to hold/retrieve information correctly.

      What I am trying to do is have a mute button on my movie that when pressed writes data to the shared object, then when the web visitor changes pages, the swf loads with the sound off. The Swf is in my header and loads with every page, I would also like to make it so the SWF goes to end frame after the initial play, so it doesn't play at all each time someone clicks on a new page in my web site.

      Here is the current page I am working on
      http://www.plakainc.com/joomla/cms

      Here is my code I am using currently:
      First Layer is ACTION:
      var Cookie:SharedObject = SharedObject.getLocal("CliftonData", "/");
      if (Cookie.data.user== undefined) {
      Cookie.data.user= new Boolean();
      Cookie.data.user=false();
      }
      if (Cookie.data.user=true()) {
      CSM.setVolume(0);
      Cookie.flush();
      } else if (Cookie.data.user=false()){
      CSM.setVolume(85);
      CSM.start();
      Cookie.flush();
      }
      Cookie.flush();

      2nd Layer is SOUND:(benhur is a MP3 in my library with linkage)

      var CSM:Sound = new Sound();
      CSM.attachSound("Benhur");
      CSM.start();

      3rd Layer is BUTTONS:
      SOUND ON BUTTON--->

      on (release) {
      CSM.setVolume(85);
      Cookie.data.user=false();
      Cookie.flush();
      // Play Sound Behavior
      CSM.start();
      // End Play Sound Behavior
      }

      MUTE BUTTON--->

      on (release) {
      CSM.setVolume(0);
      Cookie.data.user=true();
      Cookie.flush();
      }


      The rest of the layers include text and the movie clip itself.

      I have tried several approaches, from assigning the cookie.data.user to another variable, to adding the sound directly to timeline, etc. I have rewrote this code about 30 times or more, and still have yet to get the wanted results.
      I checked my local folder and yes the data is being stored there, so what exactly am I doing wrong?

      Please Help

      Kirk
      www.Plakainc.com