Archive.png This article or section documents something not included in the current version of Scratch (3.0). It is only useful from a historical perspective.
When a project is running online, it is actually running in an application called the Flash Player. These players are completely different applications from the Scratch program. They sometimes behave a bit differently from the Scratch Program, which might cause problems for some projects.
Note Note: Most of the things listed below are only problems in the Java Player which is not used anymore.

Timing

Often, the reason that projects act differently online has to do with the timing of things. There may be several scripts all starting on a given broadcast event that really need to act in a certain order. They work fine in Scratch but, because some events happen a little faster or slower online, they do not work right there. These kinds of problems occur by adding short wait or wait until blocks ahead of the events that should happen later.

Initialisation

It also helps if the project initializes properly when the Green Flag is pressed. That means that all the variables are set to the right starting values, all the sprites are put in the right starting place and so on. Any Forever loops that are checking for a certain variable value should have a short wait ahead of them to make sure that the variable has time to get set to the right starting value before the Forever loop starts checking it.

Large Sprites

Sprites can get much larger than the Stage in the Scratch Program. But in the Java Player, sprites cannot be larger than the screen. The only workaround here is to break very large sprites into smaller values.

Lists

If one tries accessing a list item that does not exist, the project fails online, but does not offline - which can be a pretty common problem in a number of projects. A good workaround is to access item n mod l of the list, where n is the wanted item number and l is the length of the list.

Mathematical Impossibilities

Division by zero, roots of negative numbers, trigonometric errors, or other mathematical impossibilities cause the script to fail offline but continue online.

Examples of mathematical impossibilities.

Obsolete Blocks

See also: Undefined Blocks

Obsolete Blocks will stop a script in the Java player, but not in the Flash or Scratch players. This makes them ideal for online/offline detectors.

Links