Skip to main content
Inspiring
February 11, 2014
Question

sharedObject not saving for iOS

  • February 11, 2014
  • 1 reply
  • 3320 views

Is anyone else having troubles using sharedObjects ?

It works properly when I compile frome the IDE. Doesnt work on device. 

Any help here would be appreciated.

This topic has been closed for replies.

1 reply

Known Participant
February 11, 2014

I'm not having the problem. You should post your code.

Applauz78Author
Inspiring
February 11, 2014

Here is my code

var so:SharedObject = SharedObject.getLocal("HighScoreData");

     so.data.highscore;

     loadScore();

     // SHARED OBJECT

     function saveScore():void

  {

      // Get the shared object.

      var so:SharedObject = SharedObject.getLocal("HighScoreData");

      

     so.data.highscore;

     

      // Update the score variable.

 

        if(theScore > so.data.highscore){

      so.data.highscore = theScore;

      theHighScore = so.data.highscore;

      }

     

      results_mc.best.text = so.data.highscore;

     

      // And flush our changes.

      so.flush();

     

      // Also, indicate the value for debugging.

      trace("Highest Score saved: " + so.data.highscore);

  }

function loadScore():void

  {

      // Get the shared object.

       var so:SharedObject = SharedObject.getLocal("HighScoreData");

       so.data.highscore;

     

      if (so.data.highscore == undefined) {

          so.data.highscore = 0;

      }

     

      //so.data.highscore = so.data.highscore;

     

      theHighScore = so.data.highscore;

      results_mc.best.text = theHighScore;

      // And indicate the value for debugging.

      trace("Loaded highscore loaded: " + so.data.highscore);

  }

Known Participant
February 11, 2014