here is the code:
main.lua
local storyboard = require("storyboard") -- Support storyboards
display.setStatusBar ( display.HiddenStatusBar ) -- hide top status bar
local splash = display.newImage("L2T.png",0,0,true) -- put up splash screen image
splash. alpha = 0
transition.to(splash,{time=4000, alpha = 1}) -- fade in splash screen -- fade in splash screen
storyboard.gotoScene("main\_scene1",{effect = "fade", time = 200,})
and main_scene1
local storyboard = require( "storyboard" )
local scene = storyboard.newScene() -- create scene object
-- Import the widget library
local widget = require( "widget" )
-- local forward references should go here --
-- define menu list items
--
local Menu = {
{
title = "Job Instruction",
color = {221,233,247,255},
purchased = true,
scene1 = "JI1.png",
scene2 = "JI2.png"
},
{
title = "Job Methods",
color = {207,234,179,255},
purchased = true,
scene1 = "JM1.png",
scene2 = "JM2.png"
},
{
title = "Job Relations",
color = {255,25,202,255},
purchased = true,
scene1 = "JR1.png",
scene2 = "JR2.png"
},
{
title = "Job Safety",
color = {221,233,247,255},
purchased = false,
scene1 = "JS1.png",
scene2 = "JS2.png"
},
{
title = "Job Coaching",
color = {221,233,247,255},
purchased = false,
scene1 = "JS1.png",
scene2 = "JS2.png"
},
{
title = "Function X",
color = {221,233,247,255},
purchased = false
},
{
title = "Function Y",
color = {221,233,247,255},
purchased = false
},
{
title = "Function Z",
color = {221,233,247,255},
purchased = false
},
{
title = "Settings",
color = {221,233,247,255},
purchased = true
}
}
-- Called when the scene's view does not exist:
function scene:createScene( event )
local group = self.view -- create a group for everything in the scene
local bg1 = display.newImage("BG.png", 0, 0) -- put up background screen image up
bg1. alpha = 0
transition.to(bg1,{time=2000, alpha = 1}) -- fade in background screen which will remove the text and images from splash screen
group:insert(bg1)
--The gradient used by the title bar
local titleGradient = graphics.newGradient(
{ 255, 255, 255, 255 },
{ 139, 157, 180, 255 },
"down" )
-- Create toolbar to go at the top of the screen
local titleBar = display.newRect( 0, 0, display.contentWidth, 32 )
titleBar.y = display.statusBarHeight + ( titleBar.contentHeight \* 0.5 )
titleBar:setFillColor( titleGradient )
titleBar.y = display.screenOriginY + titleBar.contentHeight \* 0.5
group:insert(titleBar)
-- create embossed text to go on toolbar
local titleText = display.newEmbossedText( "Learning 2 Think", 0, 0, native.systemFontBold, 20 )
titleText:setReferencePoint( display.CenterReferencePoint )
titleText:setTextColor( 255 )
titleText.x = 160
titleText.y = titleBar.y
group:insert(titleText)
-- Create a tableView
list = widget.newTableView
{
top = 38,
width = 320,
height = 448,
hideBackground = true,
maskFile = "mask-320x448.png",
onRowRender = onRowRender,
onRowTouch = onRowTouch,
}
group:insert(list)
-- insert rows into list (tableView widget)
for i = 1, #Menu do
list:insertRow{
height = 50,
rowColor = { 255, 255, 255, 0 },
onRender = onRowRender,
listener = onRowTouch
}
end
end
-- Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
-- INSERT code here (e.g. start timers, load audio, start listeners, etc.)
end
I had the storyboard code after the definition of the menu table but moved the defs to the top
No difference to how it works.
Thanks!
Stu [import]uid: 99429 topic_id: 36523 reply_id: 144819[/import]