Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

scrolling down & up or next page
Started by milestudios73 Oct 21 2019 05:42 AM

1 reply to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

milestudios73

[GLOBAL: userInfoPane.html]
milestudios73
  • Observer

  • 9 posts
  • Corona SDK

hi how do i display text that can be scrolled up or down?



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 981 posts
  • Corona SDK

You can create text using https://docs.coronalabs.com/api/library/display/newText.html.

 

Then there are multiple ways of moving it around or scrolling it, e.g.

 

1) add the text to a scrollView - https://docs.coronalabs.com/api/library/widget/newScrollView.html

2) write a simple touch function that handles the scrolling, e.g.

local function move( event )
	if event.phase == "began" then
		display.getCurrentStage():setFocus( event.target )
	elseif event.phase == "moved" then
		event.target.y = event.yStart + event.yDelta
	else
		display.getCurrentStage():setFocus( nil )
	end
	return true
end


local text = display.newText( "Hello", display.contentCenterX, display.contentCenterY, native.systemFontBold, 40 )
text:addEventListener( "touch", move )

  • milestudios73 likes this


[topic_controls]
[/topic_controls]