0

I will try to write a sharedObject item using my swf embeded into an html page. "allowscriptaccess" is setted to "never". I can't write sharedObject!

However if I set allowscriptaccess to "always", write action work well...

If I can't use sharedObject with allowscriptaccess setted to never, exist alternative for saving data?

I write a little and stupid example:

public class Main extends Sprite {
    private var SHARED_NAME:String = "__SO__";
    private var so:SharedObject;
    Security.allowDomain("*");
    Security.allowInsecureDomain("*");
    public function Main() {
        this.so = SharedObject.getLocal(this.SHARED_NAME, "/");
        this.setSharedObj("YEAHHHHHHHH");
        this.getSharedObj();
    }

    public function getSharedObj(clientId:String = null):Object {
        var url:String = "http://localhost:8080?so=" + this.so.data.test;
        var request:URLRequest = new URLRequest(url);
        var loader:URLLoader = new URLLoader();
        loader.load(request);
        return this.so.data;
    }

    public function setSharedObj(setValue:String):void {
        this.so.data.test = setValue;
        this.so.flush();
    }

}

When embed the compiled swf using AllowScriptAccess: "never", get Request never have setted the queryparam so. If set AllowScriptAccess to "always" queryparam will be correctly setted

user2354037
  • 195
  • 2
  • 8
  • No, i can't use database because i must to share user information between differents page, differenti subdomain. – user2354037 Feb 05 '16 at 12:45
  • server side session then but that's the last possibility. – BotMaster Feb 05 '16 at 12:51
  • 2
    @user2354037 [`AllowScriptAccess`](https://helpx.adobe.com/flash/kb/control-access-scripts-host-web.html) has **NOTHING** to do with `SharedObject` and you can write / read a `SharedObject` even when `AllowScriptAccess` is set to "never" ... – akmozo Feb 05 '16 at 15:42
  • @akmozo I think is related, try to write a sharedObject with AllowScriptaccess set as NEVER...YOU CAN'T!! – user2354037 Feb 05 '16 at 16:45
  • @user2354037 I tried it for many years ;) Trust me, AllowScriptAccess has NOTHING to do with SharedObject !! Did you have an online example to test it for you ? – akmozo Feb 05 '16 at 16:49

1 Answers1

0

@akmozo is right, the problem was not related by AllowScriptAccess, but from my way of testing.

The problem is: Using firefox in anonymous mode, every time you reload the page, shared object are deleted. I thought for anonymous session are saved, it is not so!

user2354037
  • 195
  • 2
  • 8