56
ActionScript language elements
Availability:
■
None of the commands described in the table are available in web players.
■
All of the commands are available in stand-alone applications, such as projectors.
■
Only
allowscale
and
exec
are available in test-movie players.
The
exec
command can contain only the characters A-Z, a-z, 0-9, period (.), and underscore
(_). The
exec
command runs in the subdirectory fscommand only. In other words, if you use
the
exec
command to call an application, the application must reside in a subdirectory named
fscommand. The
exec
command works only from within a Flash projector file.
Usage 2: To use
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
parameters
parameters.
These parameters can be strings or expressions, and they are used in a JavaScript function that
handles, or
catches
, the
fscommand()
function.
In a web browser,
fscommand()
calls the JavaScript function
moviename_DoFScommand
,
which resides in the webpage that contains the SWF file. For
moviename
, supply the name of
the Flash object that you used for the
NAME
attribute of the
EMBED
tag or the ID property of the
OBJECT
tag. If you assign the SWF file the name
myMovie
, the JavaScript function
myMovie_DoFScommand
is called.
In the web page that contains the SWF file, set the
allowScriptAccess
attribute to allow or
deny the SWF file's ability to access the web page. (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"
, outbound scripting always
fails. When
allowScriptAccess
is set to
"always"
, outbound scripting always succeeds.
When it is set to
"sameDomain"
, scripting is allowed only from SWF files that are in the same
domain as the web page. If
allowScriptAccess
is not specified in a web page, it defaults to
"sameDomain"
for Flash Player 8, and to
"always"
for previous versions of Flash Player.
When using this function, consider the Flash Player security model. For Flash Player 8, the
fscommand()
function is not allowed if the calling SWF file is in the local-with-file-system or
local-with-network sandbox and the containing HTML page is in an untrusted sandbox. For
more information, see the following:
■
Chapter 17, "Understanding Security," in
Learning ActionScript 2.0 in Flash
■
The Flash Player 8 Security white paper at http://www.macromedia.com/go/fp8_security
■
The Flash Player 8 Security-Related API white paper at http://www.macromedia.com/go/
fp8_security_apis
Summary of Contents for FLASH 8-ACTIONSCRIPT 2.0 LANGUAGE
Page 1: ...ActionScript 2 0 Language Reference ...
Page 1352: ...1352 ActionScript classes ...