Guest User

Untitled

a guest
Jul 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. local widget = require( "widget" )
  2.  
  3. -- ScrollView listener
  4. local function scrollListener( event )
  5.  
  6. local phase = event.phase
  7. if ( phase == "began" ) then print( "Scroll view was touched" )
  8. elseif ( phase == "moved" ) then print( "Scroll view was moved" )
  9. elseif ( phase == "ended" ) then print( "Scroll view was released" )
  10. end
  11.  
  12. -- In the event a scroll limit is reached...
  13. if ( event.limitReached ) then
  14. if ( event.direction == "up" ) then print( "Reached bottom limit" )
  15. elseif ( event.direction == "down" ) then print( "Reached top limit" )
  16. elseif ( event.direction == "left" ) then print( "Reached right limit" )
  17. elseif ( event.direction == "right" ) then print( "Reached left limit" )
  18. end
  19. end
  20.  
  21. return true
  22. end
  23.  
  24. -- Create the widget
  25. local scrollView = widget.newScrollView
  26. {
  27. top = 50,
  28. left = 10,
  29. right = 10,
  30. width = 300,
  31. height = 388,
  32. scrollWidth = 600,
  33. scrollHeight = 800,
  34. topPadding = 120,
  35. bottomPadding = 50,
  36. leftPadding = 50,
  37. rightPadding = 50,
  38. horizontalScrollDisabled = true,
  39. verticalScrollDisabled = false,
  40. listener = scrollListener
  41.  
  42. }
  43.  
  44. local lotsOfText = "Ransomware is a form of malware. Malware (also known as
  45. malicious software) refers to a program that is created with the intent of
  46. causing harm, this damage could take a range of forms, from destructive (such
  47. as the deletion of files) to compromising the confidentiality or integrity of
  48. the victim’s data or system(s)."
  49.  
  50. local options = {
  51. text = lotsOfText,
  52. x = display.contentCenterX,
  53. y = 200,
  54. fontSize = 16,
  55. align = "center"
  56. }
  57.  
  58. local lotsOfTextObject = display.newText( lotsOfText, 0, 0, 275, 0, "Arial",
  59. 16)
  60. lotsOfTextObject:setTextColor( 0, 0, 0 )
  61. lotsOfTextObject.x = display.contentCenterX
  62. lotsOfTextObject.y = display.contentCentery
  63. scrollView:insert(lotsOfTextObject)
  64.  
  65. end
Add Comment
Please, Sign In to add comment