[As3] solution for "checkpolicyfile" error in as3 cross-origin image reading

Source: Internet
Author: User
Tags addchild

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;

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.