Hi, I have weird problem with my scrollViews.
I have a function that creates the scroll view in a library like this:
handlers.scroll = function(group, top, bottom, listener ) local top = top or 0 local bottom = bottom or 0 local height = display.contentHeight - top - bottom local options = { top = top, left = 0, width = display.contentWidth, height = height, hideBackground = true, } if listener then options.listener = listener end local sv = widget.newScrollView(options) if group then group:insert(sv) end return sv end
In the create function of a scene I call this function like this:
self.scroll = handlers.scroll(sceneGroup, 200, 100)
This works fine. I’ve been using this function for a while without a problem, but recently I’m having this problem.
When I add display objects to the scrollView, it works fine if the object is inside the bounds of the scrollView. But I create an object beyond those bounds (the whole idea behind having the scrollView) i received this error:
ERROR: Runtime error
?:0: attempt to call field ‘newImageSheet’ (a nil value)
stack traceback:
?: in function ‘createScrollBar’
?: in function ‘_listener’
?: in function ‘?’
?: in function <?:190>
So, if I place for example this code:
local l1 = display.newText(“Text”, display.contentCenterX, 500, “Arial”, 20)
self.scroll(l1)
it will show me the error because Y is outside the height of the scrollView.
Thanks for the help!