Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local widget = require( "widget" )
- -- ScrollView listener
- local function scrollListener( event )
- local phase = event.phase
- if ( phase == "began" ) then print( "Scroll view was touched" )
- elseif ( phase == "moved" ) then print( "Scroll view was moved" )
- elseif ( phase == "ended" ) then print( "Scroll view was released" )
- end
- -- In the event a scroll limit is reached...
- if ( event.limitReached ) then
- if ( event.direction == "up" ) then print( "Reached bottom limit" )
- elseif ( event.direction == "down" ) then print( "Reached top limit" )
- elseif ( event.direction == "left" ) then print( "Reached right limit" )
- elseif ( event.direction == "right" ) then print( "Reached left limit" )
- end
- end
- return true
- end
- -- Create the widget
- local scrollView = widget.newScrollView
- {
- top = 50,
- left = 10,
- right = 10,
- width = 300,
- height = 388,
- scrollWidth = 600,
- scrollHeight = 800,
- topPadding = 120,
- bottomPadding = 50,
- leftPadding = 50,
- rightPadding = 50,
- horizontalScrollDisabled = true,
- verticalScrollDisabled = false,
- listener = scrollListener
- }
- local lotsOfText = "Ransomware is a form of malware. Malware (also known as
- malicious software) refers to a program that is created with the intent of
- causing harm, this damage could take a range of forms, from destructive (such
- as the deletion of files) to compromising the confidentiality or integrity of
- the victim’s data or system(s)."
- local options = {
- text = lotsOfText,
- x = display.contentCenterX,
- y = 200,
- fontSize = 16,
- align = "center"
- }
- local lotsOfTextObject = display.newText( lotsOfText, 0, 0, 275, 0, "Arial",
- 16)
- lotsOfTextObject:setTextColor( 0, 0, 0 )
- lotsOfTextObject.x = display.contentCenterX
- lotsOfTextObject.y = display.contentCentery
- scrollView:insert(lotsOfTextObject)
- end
Add Comment
Please, Sign In to add comment