MACROMEDIA FLASH MX 2004 - ACTIONSCRIPT Reference Manual page 187

Actionscript reference guide
Hide thumbs Also See for FLASH MX 2004 - ACTIONSCRIPT:
Table of Contents

Advertisement

To use
fscommand()
through JavaScript:
In the HTML page that embeds the SWF file, add the following JavaScript code:
1
function theMovie_DoFSCommand(command, args) {
if (command == "messagebox") {
alert(args);
}
}
If you publish your SWF file using the Flash with FSCommand template in the HTML
Publish Settings dialog box, this code is inserted automatically. The SWF file's
attributes will be the filename. For example, for the file myMovie.fla, the attributes would be
set to
myMovie
Flash Help.)
Alternatively, for Microsoft Internet Explorer applications, you can attach an event handler
directly in the
<Script Language = "JavaScript" event="FSCommand (command, args)" for=
"theMovie">
...
</Script>
In the Flash document, add the
2
on(press) {
fscommand("messagebox", "This is a message box invoked from within
Flash.");
}
You can also use expressions for
fscommand("messagebox", "Hello, " + name + ", welcome to our website!")
Select File > Publish Preview > HTML to test the document.
3
The
fscommand()
Lingo as strings, events, or executable Lingo code. If the message is a string or an event, you must
write the Lingo code to receive it from the
Director. For more information, see the Director Support Center at
support/director.
In Visual Basic, Visual C++, and other programs that can host ActiveX controls,
sends a VB event with two strings that can be handled in the environment's programming
language. For more information, use the keywords Flash method to search the Flash Support
Center at www.macromedia.com/support/flash.
About Flash Player methods
You can use Flash Player methods to control a SWF file in Flash Player from web browser
scripting languages such as JavaScript and VBScript. As with other methods, you can use Flash
Player methods to send calls to SWF files from a scripting environment other than ActionScript.
Each method has a name, and most methods take parameters. A parameter specifies a value that
the method operates upon. The calculation performed by some methods returns a value that can
be used by the scripting environment.
to open a message box from a SWF file in the HTML page
. (For more information about publishing, see "Publishing" in Using
tag, as shown in this example:
<SCRIPT>
fscommand()
fscommand()
function can send messages to Macromedia Director that are interpreted by
function to a button, as shown in this example:
and parameters, as in this example:
function and carry out an action in
fscommand()
Sending messages to and from Flash Player
and
NAME
www.macromedia.com/
fscommand()
ID
187

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH MX 2004 - ACTIONSCRIPT and is the answer not in the manual?

Questions and answers

Table of Contents