Local variables you define in a Function is local to that function. You need to define them outside your function for it to work. Here’s an example modified from your code.
-- forward references
local menu, playScene
local startPlayScene = function()
menu.isVisible = false
playScene.isVisible = true
end
local loading = function ()
--Initializing Graphic Groups
menu = display.newGroup ()
menu.isVisible = true
playScene = display.newGroup ()
playScene.isVisible = false
local r = display.newRect( 15, 70, 280, 70 ) -- x,y,w,h
r:setFillColor( 255, 255, 255 )
menu:insert(r)
local a = display.newCircle( 100, 100, 50) -- x,y, radius
a:setFillColor( 255, 255, 255 )
playScene:insert(a)
end
loading()
-- Call Play function after 3 seconds
timer.performWithDelay( 3000, startPlayScene )
You should have seen an error in the terminal when you ran your program.
BTW, a display object can only be in one group at a time. Groups can be children of other groups.
-Tom [import]uid: 7559 topic_id: 1785 reply_id: 5319[/import]