JavaScript and Flash Communication

Source: Internet
Author: User
Javascript

<embed src= "http://www.webjx.com/htmldata/2005-04-09/javascript_to_flash.swf" Quality=high
width=366 height=142
Type= "Application/x-shockwave-flash"

Pluginspage= "http://www.macromedia.com/shockwave/download/index.cgi?"
P1_prod_version=shockwaveflash "Name=" Myflash "swliveconnect=" true ">
</embed>

2. Insert the following JavaScript into the <Body> tags:

<script Language=javascript>
<!--
var InternetExplorer = Navigator.appName.indexOf ("Microsoft")!=-1;
Function Myflash_dofscommand (command, args)                  {
  var myflashobj = InternetExplorer? myFlash:document.myFlash;
  alert (args);
}
if (navigator.appname && navigator.appName.indexOf ("Microsoft")!=-1 &&
  Navigator.userAgent.indexOf ("Windows")!=-1 && navigator.userAgent.indexOf ("Windows 3.1") = = 1) {
  document.write (' <script language=vbscript\> \ n ');
  document.write (' On Error Resume Next \ n ');
  document.write (' Sub myflash_fscommand (ByVal command, ByVal args) \ n ');
  document.write (' Call Myflash_dofscommand (command, args) \ n ');
  document.write (' End sub\n ');
  document.write (' </SCRIPT\> \ n ');
}
//-->
</script>

Flash and Flash Communication

With the blending of the two methods above, two or more flash in the same HTML can send messages to each other directly. Send messages to JavaScript from a flash using Fscommand, use flash JavaScript methods to pass messages to another flash

A detailed look here:A communication example between Flash movies

Starting with Flash MX, the local connection object can be used to send messages between flash. This allows two flash movies in the same HTML or in two browser windows to send messages to each other without having to use JavaScript or Fscommand
See here in detail: using the local connection object in Flash MX (English)



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.