Reputation: 3515
I am developping this video player: http://www.horsform.com/_WIP/mjf_2011/live/demo_player/_final/index.html
In the exemple above, the player is loading this start image, to display it before the playing of the video: http://www.horsform.com/_WIP/mjf_2011/live/demo_player/_final/videos/HF_REEL.jpg
--
Here, I then tell the player to load the same image, but on another domain: http://www.horsform.com/_WIP/mjf_2011/live/demo_player/_final/index2.html
The given image is: http://www.daviddarx.com/HF_REEL.jpg
--
As you can see, it doesn't work anymore. I searched on Google and discovered that I theorically had to add a crossdomain.xml, to make sure that there isn't security protection that avoid swf to load images from other domain.
I so put these two files on my different domains, to tell the swf to accept files from all * domains: http://www.horsform.com/crossdomain.xml
http://www.daviddarx.com/crossdomain.xml
But it still isn't working... Do you know what is wrong? Am I missing something? Thank you in advance for your help!
Davis
Upvotes: 0
Views: 1240
Reputation: 4583
The RTE actually tells you what to do:
A policy file is required, but the checkPolicyFile flag was not set when this media was loaded.
from the AS3 help:
When you call the load() method of the Loader object, you can specify a context parameter, which is a LoaderContext object. The LoaderContext class includes three properties that let you define the context of how the loaded content can be used:
checkPolicyFile: Use this property only when loading an image file (not a SWF file). Specify this for an image file from a domain other than that of the file containing the Loader object. If you set this property to true, the Loader checks the origin server for a cross-domain policy file (see Website controls (cross-domain policy files)). If the server grants permission to the Loader domain, ActionScript from SWF files in the Loader domain can access data in the loaded image. In other words, you can use the Loader.content property to obtain a reference to the Bitmap object that represents the loaded image, or the BitmapData.draw() method to access pixels from the loaded image.
So you need to pass a LoaderContext
instance with the checkPolicyFile
flag set to true as a parameter of the Loader#load
method
Something like:
var loader : Loader = new Loader();
loader.load( new URLRequest( 'http://www.daviddarx.com/HF_REEL.jpg' ), new LoaderContext( true ) );
Upvotes: 1