Document stub.png This article is a stub. It may be incomplete, unfinished, or have missing parts/sections. If the article can be expanded, please do so! There may be suggestions on its talk page. (August 2018)

This tutorial shows how to make a script that detects if the mouse wheel is scrolling in Scratch 1.4, 2.0 and 3.0.

Script

The When () Key Pressed block fires either when the mouse wheel scrolls up or down, while the Key () Pressed? block returns true only if the arrow up or arrow down keys are pressed.

Add these scripts to the project:

when [up arrow v] key pressed
if <not <key [up arrow v] pressed?>> then
 set [sliding direction v] to [up]
end

when [down arrow v] key pressed
if <not <key [down arrow v] pressed?>> then
 set [sliding direction v] to [down]
end

The script is now complete.

Example Uses

  • Making a webpage in an OS
  • Creating a long list of things

See Also