User Guide

286 Chapter 11: Working with External Data
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.
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.
An
fscommand() function invokes the JavaScript function moviename_DoFSCommand in the
HTML page that embeds the SWF file, where
moviename is the name of Flash Player as assigned
by the
name attribute of the embed tag or the id attribute of the object tag. If Flash Player is
assigned the name
myMovie, the JavaScript function invoked is myMovie_DoFSCommand.
To use fscommand() to open a message box from a SWF file in the HTML page
through JavaScript:
1.
Create a new FLA file, and save it as myMovie.fla.
2.
Drag two instances of the Button component to the Stage and give them the instance names
window_btn and alert_btn, respectively, and the labels Open Window and Alert.
3.
Insert a new layer on the Timeline, and rename it Actions.
4.
Select Frame 1 of the Actions layer, and add the following ActionScript in the Actions panel:
window_btn.onRelease = function() {
fscommand("popup", "http://www.macromedia.com/");
};
alert_btn.onRelease = function() {
fscommand("alert", "You clicked the button.");
};
5.
Select File > Publish Settings, and make sure that Flash with FSCommand is selected in the
Template menu on the HTML tab.
6.
Select File > Publish to generate the SWF and HTML files.
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.