03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

var so:SharedObject = SharedObject.getLocal("savedData")<br />

Because the data may not be immediately available for reading on the device, the application<br />

must create <strong>and</strong> register a listener for the shared object identified by name. For details, see the<br />

description of the addListener() method.<br />

Parameters<br />

name:String - A string that represents the name of the object. The name can include forward<br />

slashes (/); for example, work/addresses is a valid name. Spaces are not allowed in a shared<br />

object name, nor are the following characters:<br />

~ % & \ ; : " ' , < > ? #<br />

Returns<br />

SharedObject - A reference to a shared object that is persistent locally <strong>and</strong> is available only to<br />

the current client. If Flash can't create or find the shared object, getLocal() returns null.<br />

This method fails <strong>and</strong> returns null if persistent shared object creation <strong>and</strong> storage by thirdparty<br />

Flash content is prohibited by the device.<br />

Example<br />

The following example saves the last frame that a user entered to a local shared object named<br />

kookie:<br />

// Get the kookie<br />

var my_so:SharedObject = SharedObject.getLocal("kookie");<br />

// Get the user of the kookie <strong>and</strong> go to the frame number saved for this<br />

user.<br />

if (my_so.data.user != undefined) {<br />

this.user = my_so.data.user;<br />

this.gotoAndStop(my_so.data.frame);<br />

}<br />

The following code block is placed on each SWF file frame:<br />

// On each frame, call the rememberme function to save the frame number.<br />

function rememberme() {<br />

my_so.data.frame=this._currentframe;<br />

my_so.data.user="John";<br />

}<br />

getMaxSize (SharedObject.getMaxSize method)<br />

public static getMaxSize() : Number<br />

SharedObject 559

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!