checkPolicyFile flag was not set

Blog / ActionScript ·

Sometimes the uploading of crossdomain.xml file is not enough to get the things working.

I just released a site for my client. I uploaded all the stuff on the server including crossdomain.xml file, but the site didn't works with "www". The error that popups was:

A policy file is required, but the checkPolicyFile flag was not set when this media was loaded

So the solution is pass a LoaderContext to your Loader object:

var context: LoaderContext = new LoaderContext();
    context.checkPolicyFile = true;
    var loader: Loader = new Loader();
    var img_url: String = img_src;
    var request_url: URLRequest = new URLRequest(img_url);
    loader.load(request_url, context);

Krasimir Tsonev With over two decades of deep programming expertise, I offer comprehensive web consultancy and stack audits, alongside specialized workshops, training, and engaging public speaking to elevate your team's skills and optimize your digital presence. Contact me.

Keywords: loader var context loadercontext crossdomain xml file checkpolicyfile flag set
Share the post on Twitter, Facebook, LinkedIn