Hi there. Is there any alternative way of calling parent scene’s function from it’s overlay scene?
This is the example iget from: https://docs.coronalabs.com/guide/system/composer/index.html
Is there any substitute or alternative way? Which instead of:
local
composer =
require
(
"composer"
)
local
scene = composer.newScene()
function
scene:hide( event )
local
sceneGroup = self.view
local
phase = event.phase
local
parent = event.parent
--reference to the parent scene object
if
( phase ==
"will"
)
then
-- Call the "resumeGame()" function in the parent scene
parent:resumeGame()
end
end
-- By some method (a "resume" button, for example), hide the overlay
composer.hideOverlay(
"fade"
, 400 )
scene:addEventListener(
"hide"
, scene )
return
scene
or can I call this in create listener like:
local
composer =
require
(
"composer"
)
local
scene = composer.newScene()
function
scene:create( event )
local
sceneGroup = self.view
local
phase = event.phase
local
parent = event.parent
--reference to the parent scene object
if
( phase ==
"will"
)
then
-- Call the "resumeGame()" function in the parent scene
parent:resumeGame()
end
end
-- By some method (a "resume" button, for example), hide the overlay
composer.hideOverlay(
"fade"
, 400 )
scene:addEventListener(
"create"
, scene )
return
scene
But in different ways? Thank you.