I’m having the same problem.
Error message:
Attempt to call method ‘takeFocus’ (a nil value)
I’m guessing this is a bug in the current daily build.
Please could you explain how you solved this?
Are you defining your own takeFocus function?
I’m having the same problem.
Error message:
Attempt to call method ‘takeFocus’ (a nil value)
I’m guessing this is a bug in the current daily build.
Please could you explain how you solved this?
Are you defining your own takeFocus function?
I tried sXc’s method, instead of using takeFocus which is currently not available for widget 2.0. Upon event.phase == "moved, i set focus to nil, then force my scrollview widget ( “scroller” in my case ) and instruct it to take control and do it’s thing. Hope that helps.
if event.phase == “moved” then
display.getCurrentStage():setFocus( nil )
event.target = scroller._view
event.phase = “began”
scroller._view.touch( scroller._view, event )
--scroller:takeFocus( event )
Benny, that solution works like a charm, that you!
I also had before this error (nil value). It kinda helped me in a way, but also with this code I am expiriencing bugs. I’d like to have in a scrollView dragable buttons. As soon as the script takes over, it starts to scroll the objects. But then I loose the button. Cannot click on it neither drag it. I becomes completly unresponsive.
Any suggestions?
My code (inside “moved” =phase):
-- to enable buttons in scrolling local dy = math.abs( event.y - event.yStart ) print(dy) if dy \> 350 then display.getCurrentStage():setFocus( nil ) event.target = scrollView.\_view event.phase = "began" scrollView.\_view.touch( scrollView.\_view, event ) --scrollView:takeFocus( event ) end
I also had before this error (nil value). It kinda helped me in a way, but also with this code I am expiriencing bugs. I’d like to have in a scrollView dragable buttons. As soon as the script takes over, it starts to scroll the objects. But then I loose the button. Cannot click on it neither drag it. I becomes completly unresponsive.
Any suggestions?
My code (inside “moved” =phase):
-- to enable buttons in scrolling local dy = math.abs( event.y - event.yStart ) print(dy) if dy \> 350 then display.getCurrentStage():setFocus( nil ) event.target = scrollView.\_view event.phase = "began" scrollView.\_view.touch( scrollView.\_view, event ) --scrollView:takeFocus( event ) end