scrollView causes runtime error if scrolling while storyboard change

I have several buttons in a scrollView, each of which will change the scene when touched and released.

Everything works well, with the exception that if you scroll quickly and tap a button while the scrollview is still moving, I see a runtime error in my console that I can’t pinpoint down. The error just floods the console:
[bash]
Runtime error
?:0: attempt to perform arithmetic on field ‘?’ (a nil value)
stack traceback:
[C]: ?
?: in function <?:156>
?: in function <?:218>
[/bash]
FYI, theres nothing relevant on line 156 or 218

Here’s what my button code looks like:
[lua]
– event listener for button widget
local function onButtonEvent( event )
if event.phase == “moved” then
local dx = math.abs( event.x - event.xStart )
local dy = math.abs( event.y - event.yStart )

– if finger drags button more than 5 pixels, pass focus to scrollView
if dx > 5 or dy > 5 then
scrollView:takeFocus( event )
end

elseif event.phase == “release” then
scrollView.isLocked = true
storyboard.gotoScene(“level1”)
–etc do stuff
[/lua]

So yeah, the only issue is when a button is tapped AND the scrollview is still drifting around. I thought isLocked might help, but it doesn’t do anything. I’m guessing this has to do with maybe the scrollview listener? But I didn’t actually add a listener to it, so I’m not sure.

Any help appreciated. Thanks [import]uid: 31506 topic_id: 36443 reply_id: 336443[/import]