User Guide
1090 ActionScript classes
If your SWF file is delivered over a non-HTTPS connection and you try to set this parameter
to
true, the creation of a new shared object (or the access of a previously created secure shared
object) fails and
null is returned. Regardless of the value of this parameter, the created shared
objects count toward the total amount of disk space allowed for a domain. The default value is
false.
The following diagram shows the use of the
secure parameter:
Returns
SharedObject - A reference to a shared object that is persistent locally and is available only to
the current client. If Flash Player can't create or find the shared object (for example, if
localPath was specified but no such directory exists, or if the secure parameter is used
incorrectly) this method returns
null.
This method fails and returns
null if persistent shared object creation and storage by third-
party Flash content is prohibited (does not apply to local content). Users can prohibit third-
party persistent shared objects on the Global Storage Settings panel of the Settings Manager,
located at http://www.macromedia.com/support/documentation/en/flashplayer/help/
settings_manager03.html.
Example
The following example creates a shared object that stores text that is typed into a
TextInput
component instance. The resulting SWF file loads the saved text from the shared object when
it starts playing. Every time the user presses Enter, the text in the text field is written to the
shared object. To use this example, drag a
TextInput component onto the Stage, and name
the instance
myText_ti. Copy the following code into the main Timeline (click in an empty
area of the Stage or press Escape to remove focus from the component):
// Create the shared object and set localpath to server root.
var my_so:SharedObject = SharedObject.getLocal("savedText", "/");
// Load saved text from the shared object into the myText_ti TextInput
component.
myText_ti.text = my_so.data.myTextSaved;