Shared Objects in Flash AS 3.0 - getW3Help.com - Free Web Tutorials and Resources
getw3help.com
 Subscribe
Enter your email address:
 Web Development
 HTML
 Javascript
 PHP
 Graphics & Multimedia
 Flash / AS
 Fireworks
 Illustrator
 Archives
 May 2008
 June 2008
 July 2008
 September 2008
 October 2008
 November 2008
 December 2008
 May 2009
 Share Us
RSS Feed  

Add to Google Reader or Homepage
Subscribe in NewsGator Online
Add to My AOL
 Latest Tutorials and Resources
Shared Objects in Flash AS 3.0
Nov 26, 2008 - By Makubex
3 comments
  Share on Facebook     Share on Digg     Share on Del.icio.us
In this tutorial, let us see how to use Shared Objects in Actionscript 3.0
Flash CS3, AS 3.0



Shared Objects are used to store information on the user machine. For example, you can store your website template settings. The data will be stored till the user clears his/her temporary memory of the machine.

In this example let us store a string in the user machine and we will retrieve it using shared objects.

In the below example after saving a data, refresh the page and click on retrieve button to get the saved data.

Demo:



Download Source Files

Concept:

1. Declaring Shared Object,

var myso:SharedObject;


2. Creating shared object on the client local machine..

myso = SharedObject.getLocal("myApp");

"myApp" is like unique ID, it has to be different for each flash applications you develope. We will access the values using this ID.

3. Storing data to shared object..

myso.data.val = "Data to be Stored";


"val" is the variable name.

4. Delete Shared Object..

delete myso.data.val;


5. Closing shared object..

myso.close();

After the Shared Object has been used, its wise to close it.

- End of Tutorial

Labels: ,

 Comments

Post a Comment

Hi is there a way to create Hello,
I have a Flash movie that that I want to play once on page hit, but not again when a user refresh. Is there a way to make it play once per user visit to the website?

Any help would be great appreciated.


Thanks
T-

By OpenID FORBIDDEN, at March 24, 2009 10:42 AM  

hi..
please help me how to create code when user click his name from a list name that has stored in shared object to another scene that belong to his (name) data.
Thank you

By Blogger mama, at May 26, 2009 8:56 PM  

Forbidden and Mama, the best way to find that out would be to open up flash and play around in actionscript. I just started but I am learning much of actionscript because I follow a tutorial, then add to it and play around with it until i create something else. Good luck!

By OpenID thagrimiestone, at June 25, 2009 9:56 AM  


 Recent Tutorials
 Smooth Drag and Drop using Tweener Class AS3
 Complex RollOver button using AS 3
 Google Chrome available for Download
 Window Component
 Auto Mouse Hide in Flash
 Skinning of Flash Player User Interface
 Searching Dynamic Flash Content on the Web is made...
 Launching Flash in Full Screen
 Art Work: Male Face Side View
 Adding Reflection to Dynamic Image
 Recent Comments
 Links
1. Webmaster Directory
2. Mini Pixel Icons
3. Photoshop Resources
4.
5.

6.
7.
8.
9.
10.

Your link here

Contact Us | Privacy Policy