Flash AS3 Getting Security sandbox violation when trying fetch an external swf

后端 未结 3 1505
再見小時候
再見小時候 2021-01-18 14:32

Hii, I\'m tring to load swf file to my flash application from a different server. When i try to load it on flash IDE (crl+enter) everything is working fine, but when i run t

3条回答
  •  滥情空心
    2021-01-18 15:11

    Solution: for Flex 4.x (Currently 4.6) and AS3 in Flash Builder:

        import flash.system.SecurityDomain;
        import flash.system.ApplicationDomain;
        import flash.system.LoaderContext;
        var loaderContext:LoaderContext = new LoaderContext();
        loaderContext.applicationDomain = ApplicationDomain.currentDomain;
        loaderContext.securityDomain = SecurityDomain.currentDomain; // Sets the security 
    

    context to resolve Error # 2121

    ... now load your SWF with

    loader.load(new URLRequest(webServerWebURL),loaderContext);
    

提交回复
热议问题