简体   繁体   中英

AS3: Sharing data from a shared object between a flash application and a desktop Air application

I created a shared object through a SWF file using this code:

var so:SharedObject = SharedObject.getLocal("myProjectName");

and it can be shared by all SWF files (web or locally run on stand-alone player)

However, when I try to access the same SO from an adobe Air desktop application, it can't find any data inside it, it does not create a new Shared object with the same name.. it just does not see the stored data.

I tried specifying the path so it can be specifically shared by the two apps by doing this:

var so:SharedObject = SharedObject.getLocal("myProjectName" , "/myProjectName");

but I was getting this error:

Error: Error #2134: Cannot create SharedObject.
at flash.net::SharedObject$/getLocal()

any ideas, thoughts?

I don't believe what you want is possible. A SharedObject is specific to that app. They are meant to be sandboxed so other apps cannot access them (both to prevent naming collisions and for security reasons). Also, and I could be wrong here, but I believe AIR apps and SWFs store them in completely different base directories. Simply put, you will not be able to share these objects, not even between two different SWFs or AIR apps.

Relevant question: ActionScript 3 SharedObjects don't persist across different swfs?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM