将我的标签按钮连接到页面

时间:2013-11-29 17:07:31

标签: lua corona tabbar

我正在为一个班级创建日冕基本测验游戏,并且让我的标签栏按钮连接到为他们创建的其他页面时遇到麻烦。我只是想知道是否有人可以帮助我。

main.lua

local background = display.newImage ("basketball_court.jpg")
print("PE Sports Quiz")

display.setStatusBar( display.HiddenStatusBar )

local textObj = display.newText("PE Sports Quiz",
100, 50, m11, 24)
textObj:setTextColor(250,250,250)

local widget = require ( "widget" )
local storyboard = require("storyboard")
local scene = storyboard.newScene()
local localGroup = display.newGroup()

local tabButtons =
{
    {
    width = 32, height = 32,
    defaultFile = "tab.png",
    overFile = "tab2.png",
    label = "Play",
    onPress = function() storyboard.gotoScene( "basketball1" ); end, 
    selected = true
},
{
    width = 32, height = 32,
    defaultFile = "tab.png",
    overFile = "tab2.png",
    label = "Credits",
    onPress = function() storyboard.gotoScene( "credits" ); end,
}
}

local demoTabs = widget.newTabBar
{
  top = display.contentHeight - 50,
  width = display.contentWidth,
  backgroundFile = "back.png",
  tabSelectedLeftFile = "tab.png",
  tabSelectedMiddleFile = "tab.png",
  tabSelectedRightFile = "tab.png",
  tabSelectedFrameWidth = 20,
  tabSelectedFrameHeight = 52,
  buttons = tabButtons
}

local tabBar = widget.newTabBar
{
  top = display.contentHeight - 50,
  width = display.contentWidth,
  buttons = tabButtons
}

1 个答案:

答案 0 :(得分:0)

我唯一看到的是你应该将你的credits.lua重命名为gamecredits.lua并更改它的gotoScene()调用。有一个名为“信用”的内部模块可能会导致问题。