Game porting · Flash · HTML5

Flash to HTML5 conversion: how to bring old Flash games back to the browser

Many brands, publishers, educational content owners and game portals still keep Flash games in their archives. Players cannot open them in a modern browser any more. This guide is for the people who own those games and want them back online. It explains why Flash stopped working, which conversion options you have, when each one makes sense, how to recover assets from SWF files and how to rebuild a game in an engine like Defold.

· Practical guide

By

Czytaj wersję polską →

An old Flash game rebuilt in HTML5 and running in a modern browser

Why Flash games stopped working

Adobe ended support for Flash Player on December 31, 2020 and blocked Flash content from running in Flash Player from January 12, 2021. The major browsers disabled the plugin as well. Your SWF files may still sit on a server, but a normal browser cannot play them.

Most Flash games were also made for a mouse and a desktop screen. Today many players open games on phones. So a good conversion often means more than making the old file run again.

Who converts Flash games today

  • Brands with old advergames that still carry their characters and campaigns.
  • Publishers and educational content owners with games tied to books, courses or lessons.
  • Game portals with large Flash catalogs that players still remember.
  • Studios and indie developers who want to release their old games again.

Three ways to convert a Flash game to HTML5

1. Emulation with Ruffle

Ruffle is an open source Flash Player emulator written in Rust and compiled to WebAssembly. You add it to your website, and players run the original SWF file in the browser. On its compatibility page the Ruffle team writes that most ActionScript 1 and 2 content works and that most ActionScript 3 games work well enough to be played. The project is still improving.

Emulation is the fastest option, and the game stays exactly as it was. It suits archives and simple games you do not plan to change. You do not get touch controls, a phone layout or new features, and some games may show small bugs.

2. Re-export with Adobe Animate (HTML5 Canvas)

If you still have the FLA source files, you can convert an ActionScript 3 document to an HTML5 Canvas document in Adobe Animate. You get a new document with the original layers, symbols and library items, and you publish it as HTML and JavaScript built on the CreateJS libraries. The ActionScript code is commented out, so a developer has to rewrite it in JavaScript. Some features, such as 3D transformations, are removed or replaced during the conversion.

This path suits animations, banners and simple interactive pieces with little code. In a bigger game, rewriting all the logic in JavaScript by hand is real development work anyway.

3. Rewrite in a game engine

A rewrite keeps the design, the art, the sounds and the levels and rebuilds the game in a modern engine. It takes more work than emulation. In return you get a game that runs on phones and desktops, loads quickly, supports touch and can get updates and new content. For games you want to publish, sell, license or use in a new campaign, this is usually the right choice.

Which option should you choose?

  • Ruffle when you want to keep a large archive playable with little effort and you do not need changes.
  • Adobe Animate when you have the FLA files and the content is mostly animation with simple code.
  • A rewrite when the game matters for your business, it must work on phones, or you want to update it, translate it or add a portal SDK.

You can also combine them. Put the whole archive online with Ruffle and rewrite the few games that players still search for.

How to recover assets from SWF files

Often the FLA sources are lost and only the SWF files are left. Then you can use a decompiler. JPEXS Free Flash Decompiler is an open source tool that extracts ActionScript, images, sounds, shapes, fonts and other resources from SWF files. It can also convert SWF to FLA and export shapes as SVG.

  • Export bitmaps and sounds as they are.
  • Export vector shapes as SVG, so you can redraw or rig them in a tool like Rive or Spine, or render them at a resolution that fits modern screens.
  • Extract the ActionScript as a reference for the rewrite.
  • Check the licences for fonts and music. Old licences may not cover a new release.

Make sure you own the rights to the game, or have the owner's permission, before you decompile it.

From ActionScript to Lua

ActionScript 3 is object oriented, with classes and inheritance. In Defold you write game logic in Lua, and the engine works with game objects, components and messages. In the Defold manual for Flash users you will find Flash concepts such as movie clips and the timeline next to their Defold equivalents.

  • A movie clip usually becomes a game object with a sprite, a Spine or Rive component, or a GUI node.
  • Frame scripts on the timeline become functions in a script, often called from animation events or timers.
  • Event listeners become input handling and messages between objects.
  • trace() becomes print(), as the Defold manual shows.

Line by line translation rarely works well. We read the original logic, keep the rules, values and timings that players remember, and write clean Lua around them. The new version is then much easier to maintain.

Why Defold fits Flash games

Flash was popular because artists and developers could build 2D games with rich animation quickly. Defold is a free engine with strong 2D tools and a small runtime, and one project builds for HTML5, iOS, Android and desktop. These parts of Defold match what Flash games used:

  • Rive for vector animation. The official Rive extension plays Rive animations in Defold. Rive is a vector animation tool with state machines, so Flash-style vector characters and interface animations fit it well. The extension works with WebGL 2 in the browser, but not with WebGL 1.
  • Spine for skeletal animation. The official Spine extension supports the Spine 4.2 runtime. You can rebuild Flash cut-out characters as Spine skeletons with smooth motion and small textures.
  • SpriteLoop for cut-out animation. SpriteLoop is a free animation tool by Balkan Ram Games. Its Defold extension plays SpriteLoop animations with skins and part variants, also in web builds. It is still in alpha, so we test it per project.
  • Vector, SDF and runtime fonts. Defold supports vector fonts that stay sharp at any size, signed distance field fonts and fonts generated at runtime. Runtime fonts also support full text layout, for example right to left languages. Vector fonts need WebGL 2.
  • Color emoji. Vector fonts in Defold can render COLRv1 color emoji, for example from Noto Color Emoji.
  • Rich text. Labels and GUI text in Defold support rich text markup: colors, sizes, gradients, outlines, shadows, wave and shake effects, inline sprites and links. There is also the community Defold RichText library by Björn Ritzl.
  • Small web builds. You can leave out the engine features a game does not use, which keeps the HTML5 download small. Our guide to HTML5 game optimization has more on this.

With these tools you can rebuild Flash-style animation without turning every frame into a bitmap. You keep sharp vector art and smooth motion in a light HTML5 build.

A typical Flash to HTML5 conversion project

  1. Inventory. List the games, the files you have (SWF, FLA, source code) and the rights.
  2. Test in Ruffle. See which games already play well in emulation.
  3. Choose a path for each game. Emulation, Animate export or a rewrite.
  4. Recover assets and logic from the FLA or SWF files.
  5. Rebuild the game in Defold with touch, mouse and keyboard controls and a layout for phones.
  6. Add analytics, ads or a portal SDK if you need them.
  7. Test and publish. Check desktop and mobile browsers, then release the game on your site or a web portal.

The later steps look like any other web port. You will find them in our step by step guide to web game ports. If the games are for a campaign or for lessons, read also our guides to branded games and educational web games.

Working with Codeward

Codeward is a game studio from Kraków with many client projects behind it. We port games to the browser from Flash, Unity, Godot, Construct and other tools, and we work in Defold every day. If you have old Flash games, send us the list of titles and the files you still have, and we will suggest a path for each one.

FAQ

Questions about Flash to HTML5 conversion

Can you convert a Flash game to HTML5?

Yes. Depending on the game, you can run the original SWF with the Ruffle emulator, re-export it from the FLA source in Adobe Animate as HTML5 Canvas, or rewrite it in an engine such as Defold. For games you want to update or play on phones, a rewrite is usually the best choice.

Can I convert a SWF file without the FLA source?

Often, yes. A decompiler such as JPEXS Free Flash Decompiler can extract images, sounds, shapes, fonts and ActionScript from the SWF file. Developers then use these files to rebuild the game. Check that you have the rights first.

Is Ruffle enough to bring Flash games back?

For many archives it is. The Ruffle team says that most ActionScript 1 and 2 content works and that most ActionScript 3 games are playable. Ruffle plays the game as it was, so you do not get mobile controls or new features.

Will the converted game work on phones?

A rewrite can. We add touch controls and a layout for phone screens and test on real devices. An emulated SWF keeps the original mouse and keyboard controls.

Can Flash vector animation stay vector after conversion?

Often, yes. You can rebuild vector characters and interface animations in Rive and play them in Defold with the official Rive extension. Skeletal or cut-out animation can move to Spine or SpriteLoop, and simple effects can become sprite sheets.

How long does a Flash to HTML5 conversion take?

It depends on the size of the game, the files you still have and the chosen path. Emulation can be quick. A rewrite is a development project, and we give a timeline after we look at the files.

About the author

Paweł Jarosz is a game developer in Kraków with over 13 years of experience, the founder of Codeward and Community & Content Manager at the Defold Foundation. He builds games and shares practical tutorials on the Unfolding Gamedev YouTube channel.

Have old Flash games to bring back?

Codeward is a game development studio in Kraków. We rebuild Flash games for HTML5 in Defold, for desktop and mobile browsers. Send us the list of titles and the files you still have, and we will reply as soon as we can.

What should you send us?

  • The list of games and what each one is for today.
  • The files you have: SWF, FLA or source code.
  • Where the games should run: your site, a portal or an app.
  • Whether you need changes, translations or a portal SDK.