How To: Creating a Flash Extension

Step 1: Copy the Template

Under [WORKSPACE]/engine-extensions/, copy the “test-flash” extension to a new folder. Give that folder a new name.

Step 2: Copy in the Flash library

Replace library.swf with the SWF you wish to import.

If you have a SWC library, you need to extract the SWF that resides inside of it. To do this, rename the SWC to a ZIP and extract its contents. The SWF will be inside. Use that.

Step 3: The Rest

Edit info.txt with your extension's details.

Replace icon.png with your own 32 x 32 icon.

Rename and edit TestFlash.hx to meet your needs (e.g. you want to build an API around the library). If you don’t want or need a source file, you can safely delete it and call the SWF’s functions directly from the game.

(Optional) Edit blocks.xml if you want to add some custom blocks that expose the Flash library's functionality.

That’s it. Once your extension is ready, open a game, enable the extension, save -> close -> reopen and finally test the game. If you’ve done everything correctly, the extension will work.

Example: Base 64 Encoding/Decoding

The test-flash extension is built around a base64 encoding/decoding library. If you open up TestFlash.hx, you'll find the following source.