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 program mouse wheel scrolling detection in Scratch 1.4, 2.0 and 3.0.

Script

The when () key pressed block fires both when the up and down keys are pressed and when the mouse wheel is scrolled up or down, while the key () pressed? block only returns true if the arrow key is being pressed.

Add these scripts to the project:

when [up arrow v] key pressed
if <not <key (up arrow v) pressed?>> then
 . . . // scrolling up
end

when [down arrow v] key pressed
if <not <key (down arrow v) pressed?>> then
 . . . // scrolling down
end

Example Uses

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

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.