Note that there are some explanatory texts on larger screens.

plurals
  1. POFlash Crossdomain.xml Problems
    text
    copied!<p>I'm trying to load Gravatars into Flash. Luckily, they provided a crossdomain.xml file at <code>http://en.gravatar.com/avatar/crossdomain.xml</code></p> <p>My code:</p> <pre><code>Security.loadPolicyFile("http://en.gravatar.com/avatar/crossdomain.xml"); var loader:Loader = new Loader(); loader.load(new URLRequest("http://en.gravatar.com/avatar/" + gravatar + "?s=35&amp;d=identicon")); </code></pre> <p>But I'm still getting this error: </p> <blockquote> <p>SecurityError: Error #2123: Security sandbox violation: LoaderInfo.content: [...] cannot access <a href="http://en.gravatar.com/avatar/97fbce86a5bbc520450168603172cd9e?s=35&amp;d=identicon" rel="nofollow noreferrer">http://en.gravatar.com/avatar/97fbce86a5bbc520450168603172cd9e?s=35&amp;d=identicon</a>. No policy files granted access.<br> at flash.display::LoaderInfo/get content()<br> at PiecePlayerSmall/onLoadComplete()</p> </blockquote> <p>I also monitored the traffic the Flash file is sending. It's requesting:</p> <ul> <li>My domain's crossdomain.xml file</li> <li>"<a href="http://en.gravatar.com/avatar/crossdomain.xml" rel="nofollow noreferrer">http://en.gravatar.com/avatar/crossdomain.xml</a>"</li> <li>"<a href="http://en.gravatar.com/crossdomain.xml" rel="nofollow noreferrer">http://en.gravatar.com/crossdomain.xml</a>"</li> <li>"<a href="http://en.gravatar.com/" rel="nofollow noreferrer">http://en.gravatar.com/</a>"</li> <li>then, <a href="http://en.gravatar.com/avatar/97fbce86a5bbc520450168603172cd9e?s=35&amp;d=identicon" rel="nofollow noreferrer">http://en.gravatar.com/avatar/97fbce86a5bbc520450168603172cd9e?s=35&amp;d=identicon</a></li> </ul> <p>Any suggestions for getting this to work and reducing the number of requests to gravatar.com.</p> <p><strong>EDIT:</strong> The following code works, thanks to Jacob</p> <pre><code>Security.loadPolicyFile("http://en.gravatar.com/avatar/crossdomain.xml"); var context:LoaderContext = new LoaderContext(); context.checkPolicyFile = true; context.applicationDomain = ApplicationDomain.currentDomain; var request:URLRequest = new URLRequest( "http://en.gravatar.com/avatar/" + gravatar + "?s=35&amp;d=identicon"); var loader:Loader = new Loader(); loader.load(request, context); this.addChild(loader); </code></pre> <p>Note: Do not try to access the content directly in the Event.COMPLETE</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload