1 Replies - 1241 Views - Last Post: 23 December 2008 - 02:26 PM

#1 reyco1  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • Posts: 43
  • Joined: 20-March 05

SharedObject (flash cookie)

Posted 27 March 2005 - 08:10 AM

Description: Drag an input component on to the stage and instance name it "userName". Drag a button on the the stage and instance name it "resetButton". Paste the code below onto the first frame of your movie. The AS code is commented for your learning experience :Dthis code allows a person to type his name in a a flash movie, close it and when he opens it again, it uses sharedObject to retrieve the name and populate the text field with it once again.
stop();
//create the local Shared Object
myLocalSO = sharedobject.getLocal("flashcookie");
//Populate the text field if the SO already contains a name
if (myLocalSO.data.name != null) {
     userName.text = myLocalSO.data.name;
     //Populate the text fields if the SO does not contain a name
} else {
     userName.text = "<type your name here>";
}
// Handler for userName.onchanged
userName.onchanged = function() {
     myLocalSO.data.name = userName.text;
     myLocalSO.flush();
};
//Reset the data in the SO, and text fields
resetButton.onRelease = function() {
     myLocalSO.data.name = null;
     userName.text = "<type your name here>";
     myLocalSO.flush();
};


Is This A Good Question/Topic? 0
  • +

Replies To: SharedObject (flash cookie)

#2 ajeethuk  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 0
  • Joined: 23-December 08

Re: SharedObject (flash cookie)

Posted 23 December 2008 - 02:26 PM

Give one sample also
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1