这适用于模拟器,而不适用于实际设备。返回一个Director ERROR params无法加载'menu'。我有使用屏幕的导演类混合,但在模拟器中没有返回错误。就在我安装应用程序和使用介绍屏幕之后。
module(..., package.seeall)
new = function ( params )
local localGroup = display.newGroup()
------------------
-- Imports
------------------
local ui = require ( "ui" )
------------------
-- Groups
------------------
------------------
-- Display Objects
------------------
local background = display.newImage( "Cand.png" )
local title = display.newText( "Director Class", 0, 0, native.systemFontBold, 16 )
local createdBy = display.newText( "Created by Stephen", 0, 0, native.systemFontBold, 16 )
local website = display.newText( "http://www.joinm.com", 0, 0, native.systemFontBold, 16 )
------------------
-- Link
------------------
local goBlog = function ( event )
if event.phase == "ended" then
system.openURL( "http://www.joinm.com" )
end
end
--
createdBy:addEventListener( "touch", goBlog )
website:addEventListener( "touch", goBlog )
--====================================================================--
-- BUTTONS
--====================================================================--
------------------
-- Functions
------------------
local bt01 = function ( event )
if event.phase == "release" then
director:changeScene( "stb01", "moveFromRight" )
end
end
--
local bt02 = function ( event )
if event.phase == "release" then
director:changeScene( "word", "overFromRight" )
end
end
--
local bt03 = function ( event )
if event.phase == "release" then
director:changeScene( "Hol", "moveFromTop" )
end
end
--
local bt04 = function ( event )
if event.phase == "release" then
director:changeScene( "cat", "overFromBottom" )
end
end
--
local bt05 = function ( event )
if event.phase == "release" then
director:changeScene( "Ion", "flip" )
end
end
--
local bt06 = function ( event )
if event.phase == "release" then
director:changeScene( "ni", "downFlip" )
end
end
------------------
-- UI Objects
------------------
local bt01 = ui.newButton{
default = "Bi.png",
over = "Bi.png",
onEvent = bt01,
id = "bt01"
}
--
local bt02 = ui.newButton{
default = "eu.png",
over = "eu.png",
onEvent = bt02,
id = "bt02"
}
--
local bt03 = ui.newButton{
default = "do.png",
over = "do.png",
onEvent = bt03,
id = "bt03"
}
--
local bt04 = ui.newButton{
default = "hp.png",
over = "hp.png",
onEvent = bt04,
id = "bt04"
}
--
local bt05 = ui.newButton{
default = "ca.png",
over = "ca.png",
onEvent = bt05,
id = "bt05"
}
--
local bt06 = ui.newButton{
default = "Ca.png",
over = "Ca.png",
onEvent = bt06,
id = "bt06"
}
------------------
-- Inserts
------------------
localGroup:insert( background )
localGroup:insert( title )
localGroup:insert( createdBy )
localGroup:insert( website )
localGroup:insert( bt01 )
localGroup:insert( bt02 )
localGroup:insert( bt03 )
localGroup:insert( bt04 )
localGroup:insert( bt05 )
localGroup:insert( bt06 )
------------------
-- Positions
------------------
bt01.x = 105
bt01.y = 580
--
bt02.x = 270
bt02.y = 580
--
bt03.x = 435
bt03.y = 580
--
bt04.x = 610
bt04.y = 580
--
bt05.x = 785
bt05.y = 580
--
bt06.x = 920
bt06.y = 580
--
createdBy.x = 160
createdBy.y = 440
--
website.x = 160
website.y = 460
------------------
-- Colors
------------------
------------------
-- Listeners
------------------
------------------
-- Listener
------------------
------------------
-- Initiate variables
------------------
------------------
-- MUST return a display.newGroup()
------------------
return localGroup;
end
答案 0 :(得分:0)
检查图像的文件名。它们区分大小写,但Windows模拟器不显示任何错误。
例如,因为您使用display.newImage( "Cand.png" )
,您的图片文件必须是“Cand.png”而不是“cand.png”