# Using &app;

When used as a standalone player, you can play any SWF file from the command line by entering a command of the format:

          gnash <option> <flashfile.swf>

The only required argument is the name (and location) of the file to be played.

The available options are listed in the following section, or you may view them in the terminal window by executing the following at the command line:

          gnash --help | less

The source code download of &app; includes several example SWF files. They are located in the `testsuite/samples/` directory of the &app; source directory. If you have installed &app; correctly, issuing a command similar to the following plays a short animation of a car swerving and crashing:

          gnash
          /home/<username>/gnash/testsuite/car_smash.swf

The above is useful for playing Flash files downloaded to your local system. It is also possible to play Flash files directly from the web. To do so, use the `-u` option along with the URL of the desired file.

          gnash -u http://example.domain.com/flashfile.swf

Note that this will not work with every website; some embedded Flash files are difficult to play.

## &app; Command Line Options

No options are required for &app;'s default behavior. However, there are many options that can be used to change that behavior.

    	gnash <options>
    	filename.swf

### Gnash Command Line Options

Option | Function
--- | ---
`-h, --help` | Print usage information.
`-s, --scale` <factor> | Scale the movie up/down by the specified factor.
`-c` | Produce a core file instead of letting SDL trap it. By default, SDL traps all signals, but sometimes a core file is desired to assist with debugging.
`-d, --delay` <num> | Number of milliseconds to delay in main loop. The main loop polls continuously with a delay to adjust how long &app; sleeps between iterations of the loop. The smaller the number, the higher the CPU load gets, and of course, the more iterations of the main command loop.
`-v, --verbose` | Be verbose; i.e. print important messages to stdout.
`-vv` | Be very verbose; i.e. also print debug messages to stdout.
`-va` | Be verbose about movie actions (for ActionScript debugging). This usually generates very large amounts of text and will affect &app;'s performance.
`-vp` | Be verbose about parsing the movie. This generates a fairly large amount of text, and is likely to affect &app;'s performance.
`-A, --audio-dump` <file> | Write the audio output to a wave format file.
`-D` <file> | Write the video output to a raw video file. This option is only valid with dump-gnash.
`-w, --writelog` | Write the log messages to disk using the file specified in the gnashrc file. The default is gnash-dbg.log.
`-j, --width` <num> | Specify the starting width of the window. This is mostly used only by the plugin.
`-k, --height` <num> | Specify the starting height of the window. This is mostly used only by the plugin.
`-1, --once` | Play once; exit if or when the movie reaches the last frame.

`-r, --render-mode` <0|1|2|3>

- 0 disables rendering and sound (good for batch tests).

- 1 enables rendering and disables sound.

- 2 enables sound and disables rendering.

- 3 enables rendering and sound (default).

`-t, --timeout` <sec> | Timeout and exit after the specified number of seconds. This is useful for movies which repeat themselves.
`-g, --debugger` | Start &app; with a Flash debugger console so one can set break points or watchpoints.
`-x, --xid` <ID> | This specifies the X11 window ID to display in; this is mainly used by plugins.
`-u, --real-url` <URL> | Set the _url member of the root movie. This is useful when you download a movie and play it from a different location. See also the -U switch.
`-U, --base-url` <URL> | Set base URL for this run. URLs are resolved relative to this base. If omitted or empty, it defaults to the _url member of the top-level movie (see the -u switch).
`-P, --param` <parameter> | Parameters are given in the syntax "ParamName=Value" and are mostly useful for the plugin to honour EMBED tags attributes or explicit OBJECT PARAM tags. A common use for -P is to provide FlashVars (ie: -P "FlashVars=home=http://www.gnu.org").
`-F, --fd` <filedescriptor> | Use the given filedescriptor to send requests to the host application. This is currently only used for GETURL requests. The protocol is not documented yet, and also needs improvement. Primary use for this switch is for the NPAPI plugin to properly support javascript and target windows in geturl requests.
`-C, --cookie-file` <file> | Set cookiefile path. Cookiefile contains HTTP cookies to send to the server. Primary use for this switch is for the NPAPI plugin to pass received HTTP cookies to the standalone player.
`--max-advances` <num> | Exit after the specified number of frame advances.
`--fullscreen` | Start &app; in fullscreen mode as long as the GUI and window manager support this.

## &app; Interactive Control Keys

While a movie is playing, there are several control keys. These can be used to step through frames, pause the playing, and control other actions.

### Gnash Interactive Control Keys

Key Combination | Function
--- | ---
`CTRL-Q` | Quit/Exit.
`CTRL-W` | Quit/Exit.
`ESC` | Quit/Exit.
`CTRL-P` | Toggle Pause.
`CTRL-R` | Restart the movie.
`CTRL-L` | Force immediate redraw.
`CTRL-T` | Debug. Test the set_variable() function.
`CTRL-G` | Debug. Test the get_variable() function.
`CTRL-M` | Debug. Test the call_method() function.

&gnashrc;