< Day Day Up > < Day Day Up >
Understanding and Using fscommand()
fscommand() is a function that enables a Flash movie to communicate with the
application that's currently holding the movie. The following are examples of
applications that hold (host) Flash movies:
•
Standalone Flash player
•
Web browser
•
Executable that displays the Flash movie, such as those created by third-party
tools discussed later in this lesson; or executables created using C++, Visual
Basic, and so on
It's simple to use an FSCommand from within Flash. The fscommand() function accepts
two parameters: a command name, and optional extra information. The extra information
is used as a parameter of the command:
fscommand("command_name", "optional extra stuff"); When Flash executes an fscommand(), the host application receives notification that a
command has been sent to it. The name of the command is sent, as well as any optional
parameter data. The host application must be programmed to deal with these incoming
commands; it looks at the name of the incoming command and reacts accordingly, using
any optional parameter data to complete the task. This functionality will become clearer
as we progress in this lesson.
This command forces the standalone player to play at full screen (if true) or at the defined
movie size (if false).
fscommand("allowscale", true) or
fscommand("allowscale", false) This command determines what happens if the user resizes the projector window while
your movie is playing. If true, the movie is scaled to fit 100% in the resized standalone
player window. If false, the player window is still resizable, but the movie playing inside
it remains at its original size.
fscommand("showmenu", true) or
fscommand("showmenu", false) Right-clicking (Control-clicking on a Macintosh) a movie playing in the standalone
player opens a context menu. The minimal version of this menu is shown if this
< Day Day Up >
fscommand() parameter is set to false. The full menu is shown if true.
Standalone FSCommands have no effect on Flash movies played outside the stand alone
< Day Day Up >
player.
Executing Applescripts with Fscommands
AppleScript is a built-in scripting language for the Macintosh operating system.
AppleScripts (files containing AppleScript code) are used to tell the operating system to
perform tasks such as these:
•
Batch processing
•
File conversion and manipulation
•
Performing tasks at specified times
One of the more powerful aspects of using the exec FSCommand in a Macintosh-based
projector is its capability to execute an AppleScript. Let's look at a simple example.
NOTE
This is not intended to be extensive instruction on how to create AppleScripts, but rather
a simple demonstration of how AppleScripts can be executed via Flash. For more
information on AppleScript, visit http://www.apple.com/applescript/
.
The following AppleScript opens the file named catalog.pdf on the My CD disk:
tell application "Finder"
activate
select file "catalog.pdf" of disk "My CD"