To make a notification sound function for short messages on the page, I originally wanted to use bgsound under Audio IE in HTML5 to implement it, but I found that each browser has different decoding types for Audio, and I suddenly felt like it was crashing. . If you have no other choice, it’s better to use Flash.
I believe that everyone will have some contact with or have heard about the interaction between JavaScript and Flash. In fact, this is also my first time doing this thing. I won’t go into the specific methods, there is a lot of information.
At the beginning, the functions were almost done, and there was no problem in implementation. But at the end, when I put the swf file on the resource service and then called it, something went wrong. I thought it must be another annoying cross-domain problem (CrossDomain). After searching the Internet for a long time, I finally solved the problem.
First of all, to allow your Flash to access the page, you need to add allowscriptaccess=always to the
Secondly, if you want JavaScript in your page to access Flash, you need to add the following content to your Flash script:
www.jb51.net needs to be replaced with the domain of your own page. If you are not sure, you can use alert(document.domain) to check it. If you need multiple domains to access this Flash, you can add multiple allowDomain records.