简体   繁体   English

AS3:在Flash应用程序和桌面Air应用程序之间共享来自共享对象的数据

[英]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: 我使用以下代码通过SWF文件创建了共享库:

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

and it can be shared by all SWF files (web or locally run on stand-alone player) 并且可以由所有SWF文件共享(网络或在独立播放器上本地运行)

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. 但是,当我尝试从Adobe Air桌面应用程序访问相同的SO时,它无法在其中找到任何数据,它不会创建具有相同名称的新Shared对象。它只是看不到存储的数据。

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. SharedObject特定于该应用程序。 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. 另外,我在这里可能是错的,但是我相信AIR应用程序和SWF将它们存储在完全不同的基本目录中。 Simply put, you will not be able to share these objects, not even between two different SWFs or AIR apps. 简而言之,即使在两个不同的SWF或AIR应用程序之间,您也将无法共享这些对象。

Relevant question: ActionScript 3 SharedObjects don't persist across different swfs? 相关问题: ActionScript 3 SharedObjects不会在不同的swfs上持续存在吗?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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