This article mainly introduces the method of cross-origin Flash calling in JavaScript. You only need to add one sentence to Flash. If you need it, you can refer to the function of sending a text message on the page, originally, we wanted to use bgsound under Audio + IE in HTML5 to implement it. However, we found that the decoding types of Audio in each browser were not the same, and it suddenly felt like a crash. There is no way to use Flash.
I believe that JavaScript and Flash will be used or heard. In fact, this is also the first time I have done this thing. The specific method will not be mentioned. There is a lot of information.
At the beginning, the functions were almost done, and the implementation was correct. However, at the end of the process, when the swf file is put on the Resource Service and then called again, I think it must be a cross-domain problem (CrossDomain ). After turning over the Internet for half a day, I finally fixed the problem.
First, you needAdd allowscriptaccess = always to the tag.
Second, if you want JavaScript on your page to Access Flash, you need to add the following content in your Flash script:
The Code is as follows:
Import flash. system. Security;
Security. allowDomain ('www .jb51.net ');
Here, www.jb51.net needs to be replaced with the domain of your own page. If you are not very clear, you can use alert (document. domain) to view it. If you need multiple domains to access the Flash, you can add multiple allowDomain records.