• This repository has been archived on 04/Sep/2019
  • Stars
    star
    1,326
  • Rank 35,449 (Top 0.7 %)
  • Language ActionScript
  • License
    GNU General Publi...
  • Created over 10 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Open source version of the Scratch 2.0 project editor. This is the basis for the online and offline versions of Scratch found on the website.

Scratch 2.0 editor and player Build Status

Note

Scratch 2.0 is now in maintenance mode while the team focuses efforts on Scratch 3.0. While critical issues will be addressed please note that any feature requests or minor issues will not be reviewed until the next major release.

Overview

This is the open source version of Scratch 2.0 and the core code for the official version found on http://scratch.mit.edu. This code has been released under the GPL version 2 license. Forks can be released under the GPL v2 or any later version of the GPL.

If you're interested in contributing to Scratch, please take a look at the issues on this repository. Two great ways of helping Scratch are by identifying bugs and documenting them as issues, or fixing issues and creating pull requests. When submitting pull requests please be patient -- the Scratch Team is very busy and it can take a while to find time to review them. The organization and class structures can't be radically changed without significant coordination and collaboration from the Scratch Team, so these types of changes should be avoided.

It's been said that the Scratch Team spends about one hour of design discussion for every pixel in Scratch, but some think that estimate is a little low. While we welcome suggestions for new features in our suggestions forum (especially ones that come with mockups), we are unlikely to accept PRs with new features that we haven't deeply thought through. Why? Because we have a strong belief in the value of keeping things simple for new users. To learn more about our design philosophy, see this forum post or this paper.

Quick Start: Building and Debugging with Visual Studio Code

  1. 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 y then enter).
    • It may take quite a while and appear to hang at times. Watch disk and network activity to be sure.
  2. Install Visual Studio Code.
  3. Install the "ActionScript & MXML" extension (search for @ext:as3 in the Extensions pane).
    • Reload VS Code when prompted.
  4. Add the scratch-flash folder to the VS Code workspace.
  5. Click "No SDK" then "Add more SDKs to this list...".
  6. Browse to your home directory, then go into .gradle, then gradleFx. Choose sdks and close the dialog.
  7. 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.

Building

The Scratch 2.0 build process now uses Gradle to simplify the process of acquiring dependencies: 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 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 the Scratch 2.0 editor 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 secs

Upon 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.swf

Please 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.

Debugging

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.

More Repositories

1

scratch-gui

Graphical User Interface for creating and running Scratch 3.0 projects.
JavaScript
4,239
star
2

scratch-blocks

Scratch Blocks is a library for building creative computing interfaces.
JavaScript
2,594
star
3

scratch-www

Standalone web client for Scratch
JavaScript
1,507
star
4

scratch-vm

Virtual Machine used to represent, run, and maintain the state of programs for Scratch 3.0
JavaScript
1,199
star
5

scratchjr

With ScratchJr, young children (ages 5-7) can program their own interactive stories and games.
JavaScript
662
star
6

scratch-html5

HTML 5 based Scratch project player
JavaScript
390
star
7

scratch-desktop

Scratch 3.0 as a self-contained desktop application
JavaScript
270
star
8

scratch-render

WebGL-based rendering engine for Scratch 3.0
JavaScript
260
star
9

scratchx

Scratch Extension Site
JavaScript
190
star
10

scratch-paint

Paint editor for Scratch 3.0
JavaScript
165
star
11

Scratch_1.4

Source Code repository for Scratch 1.4
C
107
star
12

scratch-link

Device interoperability layer for Windows and MacOS
C#
89
star
13

scratch-l10n

JavaScript
63
star
14

scratch-parser

Validation and parsing for Scratch projects
JavaScript
57
star
15

scratch-audio

Web Audio-based audio engine for Scratch 3.0
JavaScript
54
star
16

scratch-storage

Load and store project and asset files for Scratch 3.0
JavaScript
54
star
17

scratch-rest-api

Documentation for how to interact with the Scratch REST API
53
star
18

scratchjr-website

Code for the Scratch Jr Website
JavaScript
46
star
19

scratch-svg-renderer

Scratch SVG renderer
JavaScript
31
star
20

scratch-analysis

Analysis tool for summarizing the structure, composition, and complexity of Scratch programs.
JavaScript
24
star
21

scratch-extension-docs

[Deprecated] Sample code for Scratch 2.0 hardware and web extensions.
22
star
22

scratchr2_translations

Translations for the Scratch 2.0 website
16
star
23

scratch-resources

Source files and images for translators to translate Scratch materials
JavaScript
15
star
24

scratchwikiskin

Skin for the Scratch wiki
PHP
15
star
25

scratch-render-fonts

Fonts for Scratch SVG rendering
JavaScript
13
star
26

po2icu

An npm package for converting gettext to icu.
JavaScript
11
star
27

scratch-auth

Authentication utilities for Scratch
JavaScript
11
star
28

scratch-sb1-converter

Convert Scratch .sb files (for Scratch 1) to Scratch 2 (.sb2) in JS.
JavaScript
11
star
29

eslint-config-scratch

Shareable ESLint config for Scratch
JavaScript
8
star
30

scratch-docker

Scratch docker infrastructure npm module
Shell
7
star
31

scratch2-project-analyzer

Tools for analyzing Scratch 2.0 projects
Python
6
star
32

scratch-asset-types

Supported asset detection and types for Scratch backend
JavaScript
6
star
33

django-request-provider

Python
5
star
34

scratchx-example

Examples for working with Scratch and ScratchX extensions
JavaScript
5
star
35

swiki-navbar

A small extension for the Scratch Wiki that creates a limited navigation bar for users who are not logged in
PHP
4
star
36

scratchx-crossdomain

Standard crossdomain.xml file for use with ScratchX
4
star
37

.github

Scratch community health files
2
star
38

scratch-renovate-config

Scratch's shared configuration for Renovate
1
star