Scratch to SWF Converter

Online Converter Download Troubleshooting Known Problems Converting to EXEs or APPs

What is it?

Hey Scratchers! Have you ever made an awesome game, but the friend you wanted to send it to didn't have Scratch? Or have you made a project that would be a really cool screensaver, but then you couldn't actually install it? Well, now you can do those things and much more, thanks to my Scratch to Flash converter. As you can probably tell from the name, it converts an SB or SB2 file to an Adobe Flash SWF file. This allows you to run your Scratch projects offline, put them on your website, convert them to apps or EXE's, or send them to people who don't have Scratch installed. You can either use the online converter or you can download a copy of the program to use offline.

How do I use it?

To start the online converter, simply click here. You should see the program in the middle of the screen. Click Open Scratch File and browse for the project on your computer. Choose any settings that you want to enable. If you aren't sure, just leave the check boxes unselected. Then, click Convert to SWF. A dialog box should pop up asking to save the file. Type whatever name you want (be sure you add .swf at the end) and then click Save. This will produce a SWF file on your computer! These instructions also apply to the downloadable version. Visit the downloads page to get a copy. Then, you can simply extract the zip file and open "Converter.html".

How does it work?

When you play a Scratch game, the Scratch interpreter, a built-in part of both the Scratch website and the Offline Editor, runs the project's scripts. Although Scratch is based in Flash, the projects are never compiled to ActionScript code. Instead, the interpreter executes each block in the project by running the corresponding ActionScript functions. This converter doesn't actually compile the project to ActionScript either. It simply places it inside a copy of Scratch, along with a loader, a script which automatically reads the SB2 and tells Scratch to interpret it. It also controls any modifications you might have chosen, like hiding the green flag bar or turning on turbo mode by default. The combination of Scratch, the loader, and the project is called a projector. This is what your converted SWF file actually is.

License

Since the converter contains a copy of Scratch to run the project, it must be licensed under the same GPL v2 license as Scratch. You can find the source code for my converter here and the source code for Scratch here. The Scratch Team asked me to include the following message:

Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. See http://scratch.mit.edu.

Resources

When I started work on this project, I knew no ActionScript whatsoever. Here are some of the applications and websites that were invaluable to me. - Scratch source code - Adobe Flex SDK 4.6 - SWF file format specification - 0xED hex editor - Eclipse FDT ActionScript IDE - FFDec free Flash decompiler Also, thanks to millions of ActionScript tutorial and forum websites, especially Stack Overflow.