Accessibility

TechNote (Archived)

Using FSCommand in Macromedia Flash projectors

Macromedia Flash can use the fscommand action to control the playback and appearance of standalone projectors, as well as launch external applications. The fscommand action takes two parameters: a command and an argument. In some cases, an argument is not required. There are six commands available to projectors, which are listed below:

Command Arguments Purpose
allowscale true or false Specifying false sets the player so that the animation is always drawn at its original size and never scaled. Specifying true forces the animation to scale to 100% of the player.
exec Path to application Executes an application from within the projector. In Macromedia Flash MX this application must be in a folder named "fscommand" which is a direct subfolder of the projector.
fullscreen true or false Specifying true sets the Flash Projector to full-screen mode. Specifying false returns the player to normal window mode.
quit None Closes the projector.
showmenu true or false Specifying true enables the full set of context menu items. Specifying false removes all the context menu items except About Macromedia Flash Player.
trapallkeys true or false Passes all keystrokes (including ESC and function keys) to the projector.
allowscale

A projector's window can always be resized by the end user. Theallowscale command determines if the animation's contents are scaled as the window is resized. By default, this option is true. In some cases, scaling animation content is undesirable. For example, bitmap images may become pixelated when the animation is scaled, or frame rate may decrease as screen redraw time increases for larger screen areas. The following script, when attached to a frame or button, will prevent content in the Flash animation from scaling when the application window is resized:

 fscommand("allowscale","false"); 
exec

The exec command is used to launch an external application.

  • In Macromedia Flash MX the external application must be in a subfolder named 'fscommand'. This subfolder must be in the same directory as the projector which uses the fscommand action. This security restriction helps prevent malicious use of the exec option.

    The following script launches the Windows applicationsomeApplication.exe, which is in the fscommand folder on the same level as the projector:
     on (release) {   fscommand ("exec", "someApplication.exe"); } 
    Note: The fscommand subfolder path is not used in the argument. Place someApplication.exe inside the fscommand folder, but just use the name of the application in the argument.
  • In Macromedia Flash 5 the argument to exec must be the absolute or relative path to the application to launch. If no path is specified, Macromedia Flash assumes the same folder in which the projector resides. The following script launches the Windows application someApplication.exe, which is in the same folder as the projector:
     on (release) {   fscommand ("exec", "someApplication.exe"); } 
    Although it is possible to use absolute or relative paths to open applications in folders other than the one in which the projector resides, problems have been reported with deeply-nested directory trees or folders higher in the tree than the projector itself. Therefore, it is preferable to keep the executables in the same folder, or a folder directly beneath it.

    When specifying paths, a single dot represents the folder (equivalent to the example above ) in which the projector resides:

    // points to a folder beneath the one the projector is in:
    fscommand ("exec", "./foldername/someApplication.exe");


    Two dots refer to the parent directory of the folder in which the projector resides:

    // points to a folder in the the parent of the projector:
    fscommand ("exec", "../foldername/someApplication.exe");


    Preceding the path with a slash refers to the root folder of the disk the projector is on (absolute path).

    // assuming the disk is D, points to D:/foldername
    fscommand ("exec", "/foldername/someApplication.exe");


    Use forward or backward slashes to separate folder names in Windows projectors; use colons in Macintosh projectors. For more information see How to specify folder paths in Macintosh projectors (TechNote 15942).

Note:exec is not capable of opening a specific file with an application, just the application itself. One way to open files is to use exec to launch a Windows batch (BAT) file or Macintosh AppleScript file that then opens files in the desired application. A third-party tool that can open specific files on Windows without using batch files is available from Flashjester.

fullscreen

Determines if the the Macromedia Flash animation is displayed in a window, or full-screen (covering the entire desktop). The contents will also scale to fit the new window size, provided thatallowscale is set to true (see below). Attach the following ActionScript to the first frame of the animation to make the projector fill the desktop.

 fscommand("fullscreen", "true"); 
quit

This command causes the Flash projector to exit. The following script, when attached to a button, causes the projector quit:

 on (release) { fscommand("quit"); } 
showmenu

By default, right-clicking (on Windows) or control-clicking (on Macintosh) within a Macromedia Flash animation displays a context menu containing several options for changing the quality of the Macromedia Flash animation, such as zooming in or out, printing, and others.

If you would prefer that these menu options not be available to the user, attach the following ActionScript to the first frame of your animation:

 fscommand("showmenu", "false"); 

Note: The 'About Macromedia Flash Player' menu option will still appear even when showmenu is set tofalse.

trapallkeys

This allows special characters to be passed directly to the Flash animation, instead of performing their normal functions. For example, by invoking the trapallkeys command in a Flash animation containing a form, you may direct the focus as you wish, rather than relying on the operating system's method of tabbing between text fields.

 on (release) {
		
fscommand("trapallkeys", "true"); }

Additional Information


For Macromedia Flash animations playing in a browser,fscommand can also be used to send messages from the animation to the browser. See Scripting with Flash for more information.

AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support

Document Details

ID:tn_14280

Products Affected:

flashplayer