Wheelmouse Xtra Snippet

From Director Online Wiki
Jump to: navigation, search

Xtras Snippet

Required Xtras

Wheelmouse Xtra (free) - http://www.mods.com.au/xtras/

Description

The Wheelmouse Xtra enables use of the mousewheel in Director.

Example

Scrolling in a text field with the mousewheel.

First of all you must activate the WheelMouseEvent. This will happen "on startMovie" event of film script:

-- Lingo-Syntax
on startMovie
  startWheelMouse()
end

Now the WheelMouseEvent is available and ready to intercept for scrolling with the mousewheel in a text field. In that case create a sprite behavior on the text field sprite and intercept the event as follows.

-- Lingo-Syntax
on WheelMouseEvent value
  if value > 0 then
    member("myTextField").scrollByLine(-1)
  else
    member("myTextField").scrollByLine(1)
  end if
end

The value delivered to the WheelMouseEvent is greater than zero (mostly 120) if the mousewheel will be turn away by the user. Stiring the wheel to yourself, the value will be less than zero (mostly -120).

Don't forget to stop the WheelMouseEvent if playback has quit. This will happen on event "on stopMovie" of a film script.

-- Lingo-Syntax
on stopMovie
  stopWheelMouse()
end