开发者

Flash error - Security Sandbox Violation - on integrating Gigya in Flash

开发者 https://www.devze.com 2023-03-31 04:44 出处:网络
I am working on a existing Flash project (a Flash based game), where I need to integrate social login widget Gigya. I researched and finalized using Adobe Flash Platform Services Social.

I am working on a existing Flash project (a Flash based game), where I need to integrate social login widget Gigya. I researched and finalized using Adobe Flash Platform Services Social.

The problem is, I successfully integrated that in a test Flash file that I initially prepared. But when I integrate it in the source file of my actual Flash project, I get following开发者_运维技巧 error:

*** Security Sandbox Violation ***

SecurityDomain 'http://cdn.gigya.com/wildfire/WFApi.ashx?f=gs&asver=as3&service=socialize&enabledProviders=facebook%2Ctwitter%2Cyahoo%2Cmessenger%2Cgoogle%2Clinkedin%2Cmyspace%2Caol%2Corkut%2Cwordpress&services=socialize&APIKey=[---myApiKey---]' tried to access incompatible context 'file:///D|/FlashProjects/game.swf'

SecurityError: Error #2070: Security sandbox violation: caller http://cdn.gigya.com/wildfire/WFApi.ashx?f=gs&asver=as3&service=socialize&enabledProviders=facebook%2Ctwitter%2Cyahoo%2Cmessenger%2Cgoogle%2Clinkedin%2Cmyspace%2Caol%2Corkut%2Cwordpress&services=socialize&APIKey=[---myApiKey---] cannot access Stage owned by file:///D|/FlashProjects/game.swf.

at flash.display::Stage/requireOwnerPermissions()
at flash.display::Stage/addEventListener()
at com.Gigya.Lib::FixFocusManagerBugs/addFocusInAndOutHandlers()
at com.Gigya.Lib::FixFocusManagerBugs/onUiTopElementAddedToStage()
at flash.display::DisplayObjectContainer/addChild()
at com.Gigya.Apps.Socialize.Common::BaseForm()
at com.Gigya.Apps.Socialize.Login.Forms::MiniLogin()
at com.Gigya.Apps.Socialize.Login::LoginApp/showLoginUI()
at com.Gigya.Lib::ExternalClassLoader/onSwfLoaded()
at com.Gigya.Lib::ExternalClassLoader/ecl_INIT()

Please note that I have also included Security.allowDomain("cdn.gigya.com"); in my code, but it works in my initial test Flash (a minimal file with 2 frames and no extra components), but does not seem to be working for my actual game Flash.

Has anyone faced such an error?

Please help me out.

Thanks.


I assume you're loading a SWF, and that SWF needs to access the loader's (game's) stage? In that case, try to specify that they are in the same application and security domains when you load it:

var loader : Loader;
var context : LoaderContext;

context = new LoaderContext(true, ApplicationDomain.currentDomain,
                                    SecurityDomain.currentDomain);    

loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleLoaderComplete);
loader.load(new URLRequest(url), context);

This should load the SWF into the same application domain as the caller, which should allow them both to access each other.


I integrated each frame and the related actionscript code in my flash file one by one, saw that including one frame on the way caused this problem, I removed it, ran the flash file and everything worked perfect.

Still not sure how the problem was occurring, but it does not occur anymore now :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号