User Guide
Sending messages to and from Flash Player 73
To control a SWF file in Flash Player from web browser scripting languages such as JavaScript,
VBScript, and Microsoft JScript, you can use Flash Player methods—functions that send
messages from a host environment to the SWF file. For more information, see Developing Flex
Applications.
For more information, see the following topics:
• “Using fscommand()” on page 73
• “About using JavaScript to control Flash applications” on page 74
Using fscommand()
You use the
fscommand() function to send a message to whichever program is hosting Flash
Player, such as a web browser.
Note: Using fscommand to call Javascript does not work on the Safari or Internet Explorer browsers for
the Macintosh.
The fscommand() function has two parameters: command and arguments. To send a message to
the stand-alone version of Flash Player, you must use predefined commands and arguments. For
example, the following event handler sets the stand-alone player to scale the SWF file to the full
monitor screen size when the button is released:
my_btn.onRelease = function() {
fscommand("fullscreen", true);
};
The following table shows the values you can specify for the command and arguments parameters
of
fscommand() to control the playback and appearance of a SWF file playing in the stand-alone
player, including projectors. (A projector is a SWF file saved in a format that can run as a stand-
alone application—that is, embedding Flash Player with your content in an executable file.)
To u se
fscommand() to send a message to a scripting language such as JavaScript in a web
browser, you can pass any two parameters in the
command and arguments parameters. These
parameters can be strings or expressions and will be used in a JavaScript function that “catches,”
or handles, the
fscommand() function.
Command Arguments Purpose
quit
None Closes the projector.
fullscreen
true
or false Specifying true sets Flash Player to full-screen mode.
Specifying
false returns the player to normal menu view.
allowscale
true
or false Specifying false sets the player so that the SWF file is always
drawn at its original size and never scaled. Specifying
true
forces the SWF file to scale to 100% of the player.
showmenu
true
or false Specifying true enables the full set of context menu items.
Specifying
false dims all the context menu items except
Settings and About Flash Player.
exec
Path to
application
Executes an application from within the projector.