Skip to content

Play a SWF on the desktop

@swf2es/desktop is an Electron app that plays SWFs in a window, the <swf2es-player> element inside. With Node 22.18 or later, npm runs it with nothing to set up:

Terminal window
npx @swf2es/desktop movie.swf # a local SWF
npx @swf2es/desktop https://example.com/movie.swf # one by its URL
npx @swf2es/desktop app.xml # an AIR application, by its descriptor
npx @swf2es/desktop # the window: File › Open, or drop a SWF or a descriptor on it

The first run downloads Electron’s binary, about 100 MB, once. npx may run a version it cached before rather than a newer one: npx @swf2es/desktop@latest takes the newest. Installed (npm install -g @swf2es/desktop), the command is swf2es-desktop.

Each SWF plays in the sandbox Flash Player gave it. A local SWF goes by its UseNetwork bit: it reads the files beside it and reaches no network, or reaches the network, and sockets you allow, and reads no local file. A SWF opened by its URL plays in Flash’s remote sandbox. ActionScript 3 plays on the builtin.abc and playerglobal the player ships.

Option What it does
--trace Prints what the SWF traces to the terminal: trace() to stdout, warnings and errors to stderr.
--log-network Prints each request, socket and WebSocket of the SWF to stderr: method, URL, status, size and time. The window’s DevTools show none of them, as the main process sends them.
--log-sockets --log-network, and what each socket and WebSocket sends and receives: its size and first 512 bytes, as text or in hex. It prints whatever the SWF sends, a login among it.
--ignore-certificate-errors Does not verify any HTTPS or WSS server’s certificate, for this run.
--ignore-certificate-errors=dev.test,localhost The same for the hosts named alone, on any port.
--proxy=socks5://host:1080 Sends the SWF’s requests, sockets and WebSockets through a SOCKS5 proxy, for this run (socks5h:// is the same).
--proxy=http://user:pass@host:3128 The same through an HTTP proxy, by a CONNECT tunnel for each connection; either kind takes a username and password.
-- arguments... After an AIR application’s descriptor: the application’s own arguments.

npx reads the first -- on its command line as the end of its own options, so an application’s arguments need one before the package too: npx -- @swf2es/desktop app.xml -- --server=local (with -y, npx -y -- @swf2es/desktop …). The installed command, swf2es-desktop, takes them as they are.

--ignore-certificate-errors is for a server of your own whose certificate it signed itself. Whoever sits between you and such a host can then read and change what the SWF loads from it, so name the hosts you mean, and leave the switch off otherwise. It is never remembered: the app says so on stderr each time it starts with it.

--proxy is never remembered either, and the app says on stderr which proxy it uses (its credentials, which come from the command line alone, never). Every connection the main process makes for the SWF goes through it: http and https loads, policy files, sockets and an AIR application’s WebSockets. TLS is the app’s own, over the tunnel, so certificates are checked as without a proxy. The app still resolves a host itself, to tell whether it is on this machine or your network, which a SWF from the internet may not reach without a policy file there, and then asks the proxy for the address it judged; so a host this machine cannot resolve is not reached through the proxy either. A proxy that fails or refuses is a failed load or socket to the SWF, and a line on stderr saying why. An HTTP proxy that allows CONNECT only to port 443, as Squid does by default, refuses plain http and sockets on other ports.

In a checkout of the repository the app runs from its sources:

Terminal window
pnpm build
pnpm --filter @swf2es/desktop start movie.swf

A SWF or an AIR application that sets Stage.displayState takes the window full screen, with no click needed, as in AIR and Flash’s projector; Esc or F11 leaves. F11 is the View menu’s key for it; a SWF or an application that acts on F11 itself, setting Stage.displayState in its keyDown listener, has the key to itself, and one press toggles once.

A SWF gets a Context3D, as in Flash Player and AIR on a desktop: Stage3D content plays with nothing to set up. View › Stage3D turns it off, after which a SWF’s requestContext3D gets Error #3702, “Context3D not available”, and on again; the app remembers the choice and restarts the movie playing.

On Linux, a local file a SWF or an AIR application names that is not there as named is found as Windows and macOS find it, ignoring case, so content made there finds its files whatever case it names them in. Where two names in a directory differ only in case, neither is taken.

apps/desktop/README.md has the rest: the menus, the sandboxes in full, sockets, files and AIR applications.