You can just create a global reference to it. It isn’t recommend to have too many globals in the app, unless they are properly managed.
Just do this :
local scrollView = --Your scrollview object here global\_scrollView = scrollView -- Now you can access it with 'global\_scrollView' anywhere in the app.
The way we would suggest you do this would be to setup up a custom event and then from main.lua, dispatch the event and that would trigger code in your scene where you have an in-scope reference to the scrollView.
The global is easy. The event system is more work. Also consider:
In this case, you eliminate global issues by using a data table that holds the reference to your scrollView in a module that just gets included everywhere. Globals without the issues of globals!
You can just create a global reference to it. It isn’t recommend to have too many globals in the app, unless they are properly managed.
Just do this :
local scrollView = --Your scrollview object here global\_scrollView = scrollView -- Now you can access it with 'global\_scrollView' anywhere in the app.
The way we would suggest you do this would be to setup up a custom event and then from main.lua, dispatch the event and that would trigger code in your scene where you have an in-scope reference to the scrollView.
The global is easy. The event system is more work. Also consider:
In this case, you eliminate global issues by using a data table that holds the reference to your scrollView in a module that just gets included everywhere. Globals without the issues of globals!