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 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
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.
Summary of Contents for FLEX-FLEX ACTIONSCRIPT LANGUAGE
Page 1: ...Flex ActionScript Language Reference...
Page 8: ......
Page 66: ...66 Chapter 2 Creating Custom Classes with ActionScript 2 0...
Page 76: ......
Page 133: ...break 133 See also for for in do while while switch case continue throw try catch finally...
Page 135: ...case 135 See also break default strict equality switch...
Page 146: ...146 Chapter 5 ActionScript Core Language Elements See also break continue while...
Page 808: ...808 Chapter 7 ActionScript for Flash...
Page 810: ...810 Appendix A Deprecated Flash 4 operators...
Page 815: ...Other keys 815 Num Lock 144 186 187 _ 189 191 192 219 220 221 222 Key Key code...
Page 816: ...816 Appendix B Keyboard Keys and Key Code Values...
Page 822: ...822 Index...