Hi,
I’m getting a strange error with a call to
newScrollView:removeSelf()
The error is this:
?:0: attempt to compare number with nil
stack traceback:
[C]: ?
?: in function ‘_listener’
?: in function <?:141>
?: in function <?:218>
Here I’ll copy/paste every line of code related to the scrollview:
fixturesScroller = widget.newScrollView
{
top = 260,
left = 0,
width = 320,
height = 145,
scrollWidth = 0,
scrollHeight = 0,
horizontalScrollDisabled = true,
hideBackground = true,
listener = scrollListener,
--scrollBarOptions = {
– sheet = scrollBarSheet,
– topFrame = 1,
– middleFrame = 2,
– bottomFrame = 3
--}
}
…
local fixturesTable = display.newImage(“images/” … string.lower(country) … “regularseasonfixturetable.png”, display.contentWidth / 2, 0)
fixturesTable.anchorX = 0.5
fixturesTable.anchorY = 0
fixturesTable.alpha = 0.95
…
local fixtureTextText = display.newText(fixtureText, xpointer, ypointer, 0, 0, native.systemFont, 11)
fixtureTextText:setFillColor(0.90, 0.90, 0.90)
fixtureTextText.anchorX = 0
fixtureTextText.anchorY = 0.5
fixturesScroller:insert(fixtureTextText)
…
if cupX > 0 then
local minicup = display.newImage(“images/minicup.png”, cupX, ypointer)
minicup.anchorX = 0.5
minicup.anchorY = 0.5
fixturesScroller:insert(minicup)
end
…
local team1Score = display.newText(team1Score, xpointer + 83, ypointer, 0, 0, native.systemFont, 11)
team1Score:setFillColor(0.90, 0.90, 0.90)
team1Score.anchorX = 0.5
team1Score.anchorY = 0.5
fixturesScroller:insert(team1Score)
local team2Score = display.newText(team2Score, xpointer + 120, ypointer, 0, 0, native.systemFont, 11)
team2Score:setFillColor(0.90, 0.90, 0.90)
team2Score.anchorX = 0.5
team2Score.anchorY = 0.5
fixturesScroller:insert(team2Score)
and then the line of code which causes the problem is when I try to remove it from the display:
if fixturesScroller then
display.remove(fixturesScroller)
fixturesScroller = nil
end
(fixturesScroller:removeSelf() produces the same result)
I have another app in which I am able to successfully make the call to remove a scrollview, so there must be something I’m doing in this other app to cause the problem. I can’t spot it though. Any suggestions?
thanks