16.5. Sharing Information Between Movies Within the Same Domain


You want two movies within the same domain to have access to the same local shared object.


Specify a local path parameter when creating and opening the local shared object.


By default, local shared objects are saved to a path on the client computer that is unique to the domain, path, and name of the .swf file that is calling the getLocal( ) method. This prevents name conflicts between local shared objects from different domains or even different movies on the same domain. For example, on a system running Windows XP, if a movie named myMovie.swf served from www.person13.com/ascb/ writes a local shared object named myFirstLSO, the data is saved to the following location:

D:\Documents and Settings\[UserName]\Application Data\Macromedia\Flash Player\person13.com\ascb\myMovie.swf\myFirstLSO.sol

The name of the .swf file is included in the path to which the LSO is saved so that it will not conflict with an LSO named myFirstLSO created by another movie served from the same domain and path. However, in some cases, you want two movies on the same domain to have access to the same LSO. In these cases, you should use the optional local path parameter when creating and opening the LSO using getLocal( ).

The local path parameter (the second parameter passed to getLocal( )) must be a string that specifies the full or partial path to the .swf file that created the LSO. For example:

my_l_so = SharedObject.getLocal("myFirstLSO", ...

Get Actionscript Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.