Play an old Flash .swf file in your browser
Drop a .swf game, cartoon, e-learning module or ad banner. First you see what it is: the Flash version it was made for, its stage size, frame rate and length, whether it is ActionScript 1/2 or 3, and its fonts, sounds, video and the web addresses inside it. Then press Play and it runs here, in the Ruffle Flash emulator. No Flash Player, no extension, no download to install.
The file is read by this tab on your device and is not uploaded. While it plays, its networking is switched off: it cannot load anything, call a server or open a link.
What it shows
- The header facts, before anything runs. The compression (
FWSnone,CWSzlib,ZWSLZMA), the SWF version and the Flash Player release that introduced it, the stage size in pixels, the frame rate, the number of frames and what that comes to in seconds. - ActionScript 1/2 or 3. Read from the FileAttributes tag, with the number of code blocks and, for ActionScript 3, the document class. This is the single best predictor of whether it will play: see below.
- What it is made of. Fonts (embedded, with their glyph count, or device fonts that borrow one from the computer), sounds with their codec, sample rate and length, a streamed soundtrack, video streams with codec and size, and how many shapes, pictures, text fields, movie clips and buttons it holds. The XMP title and the tool that made it (for example
Adobe Flash CS6) when the file records them. - Every web address written in it. Links opened by
getURL, files and servers in its ActionScript 1/2 or 3 code, shared libraries it imports, and addresses in its text, each with where it was found. They are shown as text and never opened, so you can see where a game sent scores or an old banner sent clicks. - The movie, playing. In a box at the movie’s own aspect ratio, with Play and Pause, Mute, and Full screen. Click or tap the movie to give it the keyboard: games read the arrow keys, space and letters.
Reading a Flash file
- A worked example
- One of Ruffle’s own test files,
sound_embeddedprops, is 8,450 bytes. Its first bytes areCWSand2B: zlib-compressed, SWF version 43, which is Flash Player 32, the last one Adobe shipped. Unpacked it is 10,367 bytes: a 550 × 400 px stage at 24 fps with a single frame, ActionScript 3 with the document classtest_fla.MainTimeline, and two embedded MP3 sounds of 46,080 samples at 44.1 kHz mono, 1.045 seconds each. A one-frame movie is normal for ActionScript 3: the code, not the timeline, decides how long it runs. - SWF version to Flash Player
- SWF 1 to 10 match Flash Player 1 to 10 (SWF 10 covers 10.0 and 10.1). After that each SWF version is a minor release: 11 is 10.2, 12 is 10.3, 13 is 11.0, 14 to 22 are 11.1 to 11.9, 23 is 12, and 24 to 43 are 13 to 32. SWF 44 and later were written for Adobe AIR and Harman AIR 33 onwards.
- Compression
FWSfiles are stored as is.CWS(Flash Player 6, 2002, onwards) packs everything after the first 8 bytes with zlib, which is how most files you will find are saved.ZWS(Flash Player 11, 2011, onwards) uses LZMA instead and is rarer. The header’s length field is always the unpacked size.- ActionScript 1/2 or 3
- ActionScript 1 and 2 (Flash 5 to Flash 8, roughly 2000 to 2006, plus many later games that kept using them) run on the first ActionScript virtual machine, AVM1. ActionScript 3 (Flash Player 9, 2006, onwards) is a different language on a different virtual machine, AVM2. Ruffle’s AVM1 support is close to complete; its AVM2 support covers a large and growing share of games but not all of Flash’s ActionScript 3 library.
- Ruffle
- The player is Ruffle 0.6.0, an open-source Flash Player emulator written in Rust and compiled to WebAssembly (MIT or Apache-2.0 licence). It is served from this site, not from a CDN: 0.5 MB of JavaScript, then about 14 MB of WebAssembly the first time you press Play. The file’s facts above the player are read by viewhack’s own SWF reader, which needs neither.
- Tested on
- Movies generated in the test (uncompressed, zlib and LZMA; ActionScript 1/2 and 3; with fonts, sounds, a video stream, buttons, movie clips and URLs in every place the reader looks), and three files from Ruffle’s own test collection: an ActionScript 1 getURL test, an ActionScript 3 movie with two MP3 sounds, and a VP6 video that draws a TV test card. In a headless browser each plays after the click, and no request leaves the site after the file is dropped.
What this cannot do
- Play every ActionScript 3 game. Ruffle’s ActionScript 3 support is incomplete: many AS3 games and animations work, but some stop with an error, lose their sound or controls, or show nothing. ActionScript 1/2 content (most Flash games and cartoons made before about 2008) plays far more reliably.
- Reach the internet for the movie. Networking is off by design: the movie cannot load other files (levels, pictures, music, a second .swf), call a server, save a high score online, stream video over RTMP or open a link. A movie that depends on files from the web stops at that point. The addresses it would use are listed as text.
- Export to video. There is no MP4 or GIF export. A screen recorder (OBS, or the one built into your phone or computer) can capture what plays.
- Show the ActionScript source. It lists addresses and names found in the code, not the code. JPEXS Free Flash Decompiler, on your computer, shows the scripts, shapes and sounds.
- Open other Flash formats. A projector (.exe or .app with a movie inside), a source file (.fla, .xfl), a Flash video on its own (.flv, which opens in the video and audio viewer) or an AIR app (.air) is not a .swf.
- Remember your progress. Saves a game keeps in its local storage (Flash “cookies”) last only while the tab is open; nothing is stored on your device.
Other ways to play a .swf
- On your computer
- Ruffle’s desktop app for Windows, macOS and Linux opens a .swf from disk and can be allowed network access, for movies that need it. Flashpoint Archive is a preservation project that collects Flash games and animations together with the players they need.
- Looking inside
- JPEXS Free Flash Decompiler exports a .swf’s scripts, shapes, sounds, fonts and frames, and can convert frames to images.