Your main.lua should be something like below… Note line no 31 below.
[lua]display.setStatusBar( display.HiddenStatusBar )
– Import director class
director = require(“director”)
– Create a main group
local mainGroup = display.newGroup()
– Main function
local function main()
– Add the group from director class
mainGroup:insert(director.directorView)
– Change scene without effects
director:changeScene(“Aclock.lua”)
– Return
return true
end
– Begin
main()
– It’s that easy! :-)[/lua]
Now your Aclock.lua should be like following template.
[lua]module(…, package.seeall)
– GROUPS
local localGroup = display.newGroup()
– DISPLAY OBJECTS
local background = display.newRect(0,0,320,480)
local title = display.newText(“Template”, 0, 0, native.systemFontBold, 16)
– LISTENERS
local function tapped( event )
if 2 == event.numTaps then
director:changeScene(“menu”,“crossfade”);
end
end
– INIT VARS
local function initVars ()
– Inserts
localGroup:insert(background)
localGroup:insert(title)
– Positions
title.x = 160
title.y = 240
– Colors
background:setFillColor(0,200,100)
title:setTextColor( 255,255,255)
– Listeners
background:addEventListener( “tap” , tapped)
end
– CLEAN
function clean ( event )
print(“cleaned”)
end
– NEW
function new()
– Initiate variables
initVars()
– MUST return a display.newGroup()
return localGroup
end[/lua] [import]uid: 48521 topic_id: 9309 reply_id: 34047[/import]