So I have the following function.
local function gotoCraftConfrimOverlay(e) if e.phase == "moved" then local dx = math.abs(e.x - e.xStart) if dx \>= 25 then recipeScroll:takeFocus( e ) end elseif e.phase == "ended" then composer.gotoScene("CraftConfirmOverlay") end end
Pretty simple. I attach this function to a bunch of buttons that lead to various recipes. All of these recipe buttons are placed in the recipeScroll scroll group. So if I click on a button, I want it to open the craft confirm overlay. If I drag the scroll view a little bit, the recipe group should scroll. That all works fine right now.
But now I want it so if I drag the recipeScroll widget over, lets say 50 pixels, I want it to load a new page of recipes. But the phase won’t end unless I set the stage and set focus. Or so I understand? But I can’t set the stage focus to e.target because that is the recipe buttons. And setting the stage focus to recipeScroll does nothing as well. I need the focus to switch to the recipeScoll widget so I can scroll, and then once that has focus, end that phase and call a function.
Can anyone please explain how I could do that.
