THIS MOD IS IN BETA. BUGS AND ISSUES MAY APPEAR
This is a open-sourced modification of scratch 2.0 aimed for better usabilty. Feel free to contritube!
- Build at least once using the Gradle instructions listed in the "Building" instructions below.
- TL;DR: run
./gradlew build -Ptarget="11.6"in a terminal (on Windows, replace/with\as usual). - This will download and unpack the necessary SDKs.
- You may need to agree to a few licenses (press
ythenenter). - It may take quite a while and appear to hang at times. Watch disk and network activity to be sure.
- TL;DR: run
- Install Visual Studio Code.
- Install the "ActionScript & MXML" extension (search for
@ext:as3in theExtensionspane).- Reload VS Code when prompted.
- Add the
lithium-scratchModfolder to the VS Code workspace. - Click "No SDK" then "Add more SDKs to this list...".
- Browse to your home directory, then go into
.gradle, thengradleFx. Choosesdksand close the dialog. - Your list of SDKs should now include something starting with "Apache Flex 4.15.0"; choose that.
You should now be able to build and debug using your usual Visual Studio Code hotkeys. The defaults are Ctrl+Shift+B (or Cmd+Shift+B on Mac) to build and F5 to run.
Note that this will build a SWF which requires a very recent version of Flash, so the IDE build should only be used for development and debugging. The Gradle builds (see below) are configured for compatibility with a broad range of Flash versions.
Check asconfig.json for the configuration settings used by the IDE build.
You'll need Gradle to build. The necessary Flex SDKs will automatically be downloaded and cached for you. The Gradle wrapper is included in this repository, but you will need a Java Runtime Environment or Java Development Kit(preferrably jdk 8) in order to run Gradle; you can download either from Oracle's Java download page. That page also contains guidance on whether to download the JRE or JDK.
There are two versions of this mod that can be built from this repository. See the following table to
determine the appropriate command for each version. When building on Windows, replace ./gradlew with .\gradlew.
| Required Flash version | Features | Command |
|---|---|---|
| 11.6 or above | 3D-accelerated rendering | ./gradlew build -Ptarget="11.6" |
| 10.2 - 11.5 | Compatibility with older Flash (Linux, older OS X, etc.) | ./gradlew build -Ptarget="10.2" |
A successful build should look something like this (SDK download information omitted):
$ ./gradlew build -Ptarget="11.6"
Defining custom 'build' task when using the standard Gradle lifecycle plugins has been deprecated and is scheduled to be removed in Gradle 3.0
Target is: 11.6
Commit ID for scratch-Flash is: e6df4f4
:copyresources
:compileFlex
WARNING: The -library-path option is being used internally by GradleFx. Alternative: specify the library as a 'merged' Gradle dependendency
:copytestresources
:test
Skipping tests since no tests exist
:build
BUILD SUCCESSFUL
Total time: 13.293 secsUpon completion, you should find your new SWF in the build subdirectory.
$ ls -R build
build:
10.2 11.6
build/10.2:
ScratchFor10.2.swf
build/11.6:
Scratch.swfPlease note that the Scratch trademarks (including the Scratch name, logo, Scratch Cat, and Gobo) are property of MIT. For use of these Marks, please see the Scratch Trademark Policy.
Here are a few integrated development environments available with Flash debugging support:
It may be difficult to configure your IDE to use Gradle's cached version of the Flex SDK. To debug the Scratch 2.0 SWF with your own copy of the SDK you will need the Flex SDK version 4.10+, and playerglobal.swc files for Flash Player versions 10.2 and 11.6 added to the Flex SDK.
After downloading playerglobal11_6.swc and playerglobal10_2.swc, move them to
${FLEX_HOME}/frameworks/libs/player/${VERSION}/playerglobal.swc. E.g., playerglobal11_6.swc should be located
at ${FLEX_HOME}/frameworks/libs/player/11.6/playerglobal.swc.
Consult your IDE's documentation to configure it for your newly-constructed copy of the Flex SDK.
If the source is building but the resulting .swf is producing runtime errors, your first course of action should be to download version 4.11 of the Flex SDK and try targeting that. The Apache foundation maintains an installer that lets you select a variety of versions.