Answer the question
In order to leave comments, you need to log in
How to work with compositor in corona SDK? How to pause timers, delete variables in hide and destroy events if they are not visible there?
In the stock composer-e, the official documentation says that all scene objects must be created in the scene:create event, and deleted / suspended in the scene:hide and scene:destroy events. I can't figure out how this should work, because variables created in the scene:create function cannot be seen in other functions (if not made global)?
Answer the question
In order to leave comments, you need to log in
Variables that should be visible in different scene methods can either be created at the beginning of the file as local variables, or placed in self.
local some_var = 'test local'
local scene = composer.newScene()
function scene:create()
self.other_var = 'test self'
end
function scene:show()
print(some_var, self.other_var)
end
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question