Scrollview Code

I am using the scrollview code that's in the sample code area. I have it set up and it's working great. One change I wanted to make but not sure where to make it in the file is the size of the scrollview screen. Right now it fills up the entire screen and you can't even see my background page. Plus I have a backbutton that's on this page and I need to adjust the size of the screen so you can see that button. So to make it even I just want to make the overall size of the scroll box smaller. Is anybody familiar with that file and can help me?

I want it in a small box kind of like the tilt monster help screen.

This is the text from the main file in the code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
module(..., package.seeall)
 
-->main function - MUST return a display.newGroup()
function new()
local localGroup = display.newGroup()
--> This is how we start every single file or "screen" in our folder, except for main.lua
        -- and director.lua
        --> director.lua is NEVER modified, while only one line in main.lua changes, described in that file
------------------------------------------------------------------------------
------------------------------------------------------------------------------
local physics = require ("physics")
physics.start ()
 
--import the scrolling classes
local scrollView = require("scrollView")
local util = require("util")
 
-->Background
local background = display.newImage ("blackbackground.png")
localGroup:insert(background)
--> This sets the background
 
-- Setup a scrollable content group
local topBoundary = display.screenOriginY
local bottomBoundary = display.screenOriginY
local scrollView = scrollView.new{ top=topBoundary, bottom=bottomBoundary }
 
local myText = display.newText("Move Up to Scroll", 0, 0, native.systemFontBold, 16)
myText:setTextColor(0, 0, 0)
myText.x = math.floor(display.contentWidth*0.5)
myText.y = 48
scrollView:insert(myText)
 
-- add some text to the scrolling screen
local lotsOfText = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur imperdiet consectetur euismod. Phasellus non ipsum vel eros vestibulum consequat. Integer convallis quam id urna tristique eu viverra risus eleifend.\n\nAenean suscipit placerat venenatis. Pellentesque faucibus venenatis eleifend. Nam lorem felis, rhoncus vel rutrum quis, tincidunt in sapien. Proin eu elit tortor. Nam ut mauris pellentesque justo vulputate convallis eu vitae metus. Praesent mauris eros, hendrerit ac convallis vel, cursus quis sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque fermentum, dui in vehicula dapibus, lorem nisi placerat turpis, quis gravida elit lectus eget nibh. Mauris molestie auctor facilisis.\n\nCurabitur lorem mi, molestie eget tincidunt quis, blandit a libero. Cras a lorem sed purus gravida rhoncus. Cras vel risus dolor, at accumsan nisi. Morbi sit amet sem purus, ut tempor mauris.\n\nLorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur imperdiet consectetur euismod. Phasellus non ipsum vel eros vestibulum consequat. Integer convallis quam id urna tristique eu viverra risus eleifend.\n\nAenean suscipit placerat venenatis. Pellentesque faucibus venenatis eleifend. Nam lorem felis, rhoncus vel rutrum quis, tincidunt in sapien. Proin eu elit tortor. Nam ut mauris pellentesque justo vulputate convallis eu vitae metus. Praesent mauris eros, hendrerit ac convallis vel, cursus quis sem. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque fermentum, dui in vehicula dapibus, lorem nisi placerat turpis, quis gravida elit lectus eget nibh. Mauris molestie auctor facilisis.\n\nCurabitur lorem mi, molestie eget tincidunt quis, blandit a libero. Cras a lorem sed purus gravida rhoncus. Cras vel risus dolor, at accumsan nisi. Morbi sit amet sem purus, ut tempor mauris. "
 
local lotsOfTextObject = util.wrappedText( lotsOfText, 39, 14, native.systemFont, {0,0,0} )
scrollView:insert(lotsOfTextObject)
lotsOfTextObject.x = 24
lotsOfTextObject.y = math.floor(myText.y + myText.height)
 
-- Important! Add a background to the scroll view for a proper hit area
local scrollBackground = display.newRect(0, 0, display.contentWidth, scrollView.height+64)
scrollBackground:setFillColor(255, 255, 255)
scrollView:insert(1, scrollBackground)
 
scrollView:addScrollBar()
 
 
local backbutton = display.newImage ("backbutton.png")
localGroup:insert(backbutton)
backbutton.x = 75
backbutton.y = 300
backbutton.xScale = .5
backbutton.yScale = .5
 
local function touchedBackbutton (event)
        if ("ended" == event.phase) then
                director:changeScene( "titlescreen", "fade" )   
        end     
end
 
backbutton:addEventListener ("touch", touchedBackbutton)
 
                
-->MUST return a display.newGroup()
 
 
------------------------------------------------------------------------------
------------------------------------------------------------------------------
        
--> This is how we end every file except for director and main, as mentioned in my first 
 
return localGroup
 
end

No Solutions?!

Regards,

I believe the solution (if I recall correctly) was to examine the code in Tilt Monster and take it from there and modify it to suit the project :)

There was another thread by the same user regarding this.

Peach :)

Hey Peach,

Thanks for the orientation!

BTW would be a good habit to post just one thread of the same question as it would help everybody including myself as in this case here that I asked about solutions because it would serve for me as well.

But that`s okay.

See yah,
Rodrigo.

views:1697 update:2011/10/17 21:25:02
corona forums © 2003-2011