How to call flash across domains in JavaScript _javascript tips

Source: Internet
Author: User

To do a message on the page on the function of the beep, originally wanted to use the HTML5 in the Audio+ie under the bgsound to achieve, but found that each browser to the audio of the type of decoding is not the same, suddenly a feeling of collapse. There is no way to use flash to secure a bit.

I believe that JavaScript and flash interaction people will have contact or heard. Actually, it's the first time I've had this whole thing. The concrete method does not say, a lot of information.

In the beginning, the function is done almost, realize and no problem. But that's it. Finally, put the SWF file on the resource service and then when the problem comes out, I just want to be sure it's a cross domain problem (crossdomain) that makes people's eggs ache. Later on the internet turned over half a day finally to fix the problem.

First of all, to get your flash access to the page, you need to add allowscriptaccess=always to the <embed> tag.

Second, you need to make the JavaScript in your page accessible to flash by adding the following in your flash script:

Copy Code code as follows:

Import flash.system.Security;
Security.allowdomain (' www.jb51.net ');

Where www.jb51.net needs to replace the domain of your own page, if you are not very clear you can use alert (document.domain) to view. If you need multiple domain access to this flash you can add more than one Allowdomain record.

Related Article

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.