As3 cross-origin image reading problems and solutions
Write a program that calls the remote image and call the code to display the image in the onloadcomplete function. The Code is as follows:
VaR image: bitmap = e.tar get. content as bitmap;
_ Canvas. addchild (image );
No response. Then changed to the following:
VaR picloader: loader = loaderinfo(e.tar get). loader;
_ Canvas. addchild (picloader );
You can. After Google, I found this article.
××××××××××××××××××××××××××××××××××××××××××× ××××××××××××××××××××××××××××
In the past few days, when a project uses loader to call external image files, it always reports "... sandbox... checkpolicyfile "error message, but I have set crossdomain on the image server. XML files have a long headache! I finally found a solution today!
Flash Player 9 is more difficult than before in terms of security policies! Here is the solution!
Import flash. display. loader;
Import flash.net. URLRequest;
Import flash. system. loadercontext;
VaR LC: loadercontext = new loadercontext (true );
VaR Loader: loader = new loader ();
Loader. Load (New URLRequest ("http: // XXXXXXXX/xxxx.jpg"), LC );
// The loadercontext class must be added to the original call base;