1 Reply Latest reply on Dec 12, 2007 7:18 AM by kglad

    sharedObjects not working

    shangrier Level 1
      I am trying to create a cookie using sharedObjects. It is basic. I want to test wether a user has been to a particular web page before. If they have, I want to redirect them to another page. If not, continue to load the current page.
      Sounds simple... But my code is not working and I am going to pull my hair out!
      I created a small flash swf file that I am including on a html page. The flash file simply checks the sharedObject on the users machine to see if the file exists. (in theory)
      Can you see what I am missing to make this work?

      This is what I have...
      The first script that executes is this:
      stored_user_rest = local_data.data.user_rest; //reads the file to see if they visited before
      if (stored_user_rest != "1") { // I set the local_data.data.user_rest file to "1" later on to indicate they have been here before
      getURL(" http://www.discoversml.com/previous.html"); //this is the url I want to redirect to. If the answer is false then it should continue on and go to the next scene where the script lives below:

      Then in a new scene same flash file I put:
      local_data = SharedObject.getLocal("user_data"); //write the file for the first time
      local_data.data.user_rest = "1"; //set user_rest = 1 to indicate they have visited now
      local_data.flush ();


      So, in theory, when they return to this page, which is restaurant.html, the flash swf plays and executes the scripts and hopefully will find that they have been there before and redirect to previous.html.