Question

i'm using this method to save shared object in specific location but i'm not able to give path

SharedObject.getLocal("save","how to give path here for window");

and this gives following error

Error: Error #2130: Unable to flush SharedObject.
at Error$/throwError()
at flash.net::SharedObject/flush()
at OnlineDiagramEditor/SaveData_mouseDownHandler()[C:\Users\ruchidod\Adobe Flash Builder 4.6\OnlineDiagramEditor\src\OnlineDiagramEditor.mxml:3240]
at OnlineDiagramEditor/__SaveData_mouseDown()[C:\Users\ruchidod\Adobe Flash Builder 4.6\OnlineDiagramEditor\src\OnlineDiagramEditor.mxml:3522]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
at mx.managers::SystemManager/mouseEventHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2918]

some times it gives

Error: Error #2134: Cannot create SharedObject.
at flash.net::SharedObject$/getLocal()
at OnlineDiagramEditor/SaveData_mouseDownHandler()[C:\Users\ruchidod\Adobe Flash Builder 4.6\OnlineDiagramEditor\src\OnlineDiagramEditor.mxml:3236]
at OnlineDiagramEditor/__SaveData_mouseDown()[C:\Users\ruchidod\Adobe Flash Builder 4.6\OnlineDiagramEditor\src\OnlineDiagramEditor.mxml:3522]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[E:\dev\4.y\frameworks\projects\framework\src\mx\core\UIComponent.as:13152]
at mx.managers::SystemManager/mouseEventHandler()[E:\dev\4.y\frameworks\projects\framework\src\mx\managers\SystemManager.as:2918]
Was it helpful?

Solution

SharedObjects are automatically saved in a predefined location and they aren't cross-domain, that means that each domain can read only its own SO.

The localPath is only a parameter that defines in which subfolder of the predefined location Flash player should save the SO. This is, by default, referred to the SWF that is saving the SO itself.

localPath: String [optional]- A string that specifies the full or partial path to the SWF file that created the shared object, and that determines where the shared object is stored locally. The default value is the full path.

Also:

Although the localPath parameter is optional, you should give some thought to its use, especially if other SWF files need to access the shared object. If the data in the shared object is specific to one SWF file that will not be moved to another location, then use of the default value makes sense. If other SWF files need access to the shared object, or if the SWF file that creates the shared object will later be moved, then the value of this parameter affects whether any SWF files are able to access the shared object. For example, if you create a shared object with localPath set to the default value of the full path to the SWF file, then no other SWF file can access that shared object. If you later move the original SWF file to another location, then not even that SWF file can access the data already stored in the shared object.

So if you've multiple SWF on the same domain which need to access the same SO, you need to give a path to getLocal(), the same for each SWF.

http://help.adobe.com/en_US/AS2LCR/Flash_10.0/help.html?content=00001508.html


For example:

In Windows, SO are stored in %APPDATA%\Macromedia\Flash Player\#SharedObjects\.

Here is a subfolder for your user, like 5D3RT21F.

Then we have a subfolder for the domain that originated the SO file, like www.flickr.com.

Then several subfolders to reflect the relative path of the SWF on the domain, like \apps\slideshow\show.swf\, you can find the SO file in here.

But if you specify / (root) as localPath then you'll find the SO file directly in www.flickr.com and other SWF on the same domain will access it freely.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top