Accessibility
 
Home > Products > Flash > Support > Publishing and Exporting
Flash Icon Macromedia Flash Support Center - Publishing and Exporting
Sending messages from Flash to a scripting language

To send messages to a scripting language from an action within a Flash movie, use the FSCommand action in a GetURL button or frame action. The text you enter in the URL field is called the command string and the text you enter in the Target field is called the argument string. When you assign the FSCommand action these strings are passed to the script in the HTML document and can be used for any purpose you need. To respond to FSCommand messages in a script, you should match the function name with the NAME/ID property set in the OBJECT and EMBED tags of the Flash Player movie that is sending the FSCommand messages.

Note: The FSCommand syntax doesn't allow you to execute function calls like JavaScript. FSCommand can pass only two strings to the NAME/ID_DoFSCommand(command, args) function. To execute a function call, evaluate the string contained in the command variable and execute the function call if it contains the desired value. This technique must be used when FSCommand passes more than one possible string since only one function responds to the FSCommand event.

Here is an example:

<SCRIPT LANGUAGE="JavaScript"> 
<!--  
function navmovie_DoFSCommand(command, args) { 
  if ( command == "init" ) { 
    var buttons = parent.InternetExplorer ? window.navmovie : window.document.navmovie; 
    if (buttons != null ) { 
      buttons.GotoFrame(parent.targetFrame);
       // This function ensures that thenavigation bar movie is set to the proper 
       // keyframe when it initially loads . The argument init is the name you use 
       // as the command paramter for the action attached to the first keyframe 
       // in the navigation bar  movie. 
    } 
  } 
//--> 
</SCRIPT> 
<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
CODEBASE="http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0"" 
ID=navmovie WIDTH=100% HEIGHT=100%> 
<PARAM NAME="movie" VALUE="navigation.swf"> 
<PARAM NAME="play" VALUE="false"> 
<PARAM NAME="quality" VALUE="high"> 
<EMBED NAME=navmovie SRC=navigation.swf WIDTH=100% HEIGHT=100% PLAY=false
SWLIVECONNECT=true QUALITY=high>
</OBJECT>
To Table of Contents Back to Previous document Forward to next document