A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: SharedObjects How-To (or How to remove the middleware)

Hybrid View

  1. #1
    Senior Member
    Join Date
    Sep 2000
    Posts
    273
    Want to know how to use a sharedobject to write to the user's HDD for directly storing variables and other such things?

    Code:
    function setCookie() 
    {
       _root.myCookie_so.data.strTest = _root.strTest;
       _root.myCookie_so.flush();
    }
    
    function readCookie()
    {
    	_root.strTesting = _root.myCookie_so.data.strTest;
    }
    
    _root.onLoad = function()
    {
    	// set up the "cookie" to use for data storage
    	myCookie_so = SharedObject.getLocal("spyder");
    	_root.readCookie();
    }
    There you have it -- if you want to test it out, go to the address at the bottom of the post. Change the first string and click the "Set" button to store the data on the user's HDD. You can either click "Retrieve" to pull the information off the user's HDD, or you can re-load the page and watch it pull the information in for you. It's a very simplistic example, but I didn't have much time to set it up for you.

    Hope this helps those who were trying to figure it out.

    Spyder

    http://perfectweb.org/SharedObjects.html
    http://perfectweb.org/SharedObjects.fla

  2. #2
    Senior Member
    Join Date
    Apr 2001
    Posts
    251
    I thought the player was supposed to ask permission first? Mine didn't.

  3. #3
    Senior Member
    Join Date
    Sep 2000
    Posts
    273
    It only asks permission if you are going to be going above the default limit for object size (100Kb).

    Spyder

  4. #4
    Senior Member
    Join Date
    Apr 2001
    Posts
    251
    AHA!

  5. #5
    Arckid - Curving the Web
    Join Date
    Dec 2000
    Location
    India
    Posts
    1,412
    this is great and feature like Swiff Canvas ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center