User Guide
Global Functions 55
The fscommand() function lets a SWF file communicate with a script in a web page.
However, script access is controlled by the web page's
allowScriptAccess setting. (You set
this attribute in the HTML code that embeds the SWF file—for example, in the
PARAM tag
for Internet Explorer or the
EMBED tag for Netscape. When allowScriptAccess is set to
"never", a SWF file cannot access web page scripts. With Flash Player 7 and later, when
allowScriptAccess is set to "always", a SWF file can always access web page scripts. When
allowScriptAccess is set to "sameDomain", scripting is allowed only from SWF files that
are in the same domain as the web page; scripting is always allowed with previous versions of
Flash Player. If
allowScriptAccess is not specified in an HTML page, the attribute is set by
default to
"sameDomain" for SWF files of version 8 and later, and to "always" for SWF files
of version 7 and earlier.
Usage 1: To use
fscommand() to send a message to Flash Player, you must use predefined
commands and parameters. The following table shows the values that you can specify for the
fscommand() function's command and parameters parameters. These values control SWF
files that are playing in Flash Player, including projectors. (A projector is a SWF file saved in a
format that can run as a stand-alone application—that is, without Flash Player.)
Command Parameter 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 hides
all of the context menu items except About
Flash Player and Settings.
exec Path to application Executes an application from within the
projector.
trapallkeys true or false Specifying true sends all key events,
including accelerator keys, to the
onClipEvent(keyDown/keyUp) handler in
Flash Player.