Lingo Dictionary > S > scrollTop

 

scrollTop

Syntax

member(whichCastMember).scrollTop
the scrollTop of member whichCastMember

Description

Cast member property; determines the distance, in pixels, from the top of a field cast member to the top of the field that is currently visible in the scrolling box. By changing the value for scrollTop member property while the movie plays, you can change the section of the field that appears in the scrolling field.

This is a way to make custom scrolling behaviors for text and field members.

For example, the following Lingo moves the field cast member Credits up or down within a field's box, depending on the value in the variable sliderVal:

global sliderVal

on prepareFrame
	newVal = sliderVal * 100
	member("Credits").scrolltop = newVal
end

The global variable sliderVal could measure how far the user drags a slider. The statement set newVal = sliderVal * 100 multiplies sliderVal to give a value that is greater than the distance the user drags the slider. If sliderVal is positive, the text moves up; if sliderVal is negative, the text moves down.

Example

This repeat loop makes the field Credits scroll by continuously increasing the value of scrollTop:

on wa
	member("Credits").scrollTop = 1
	repeat with count = 1 to 150
		member("Credits").scrollTop = member("Credits").scrollTop + 1
		updateStage
	end repeat
end