Lua 在Corona SDK中,由于某些原因,我的按钮不会出现在屏幕上
在Corona SDK中,由于某些原因,我的按钮不会出现在屏幕上这是我的代码我缺少了什么 本地编写器=需要(“编写器”) 本地场景=composer.newScene() --包括科罗纳的“小部件”库 本地小部件=需要“小部件” --处理按钮事件的函数 本地功能把手按钮通风口(事件) 结束Lua 在Corona SDK中,由于某些原因,我的按钮不会出现在屏幕上,lua,coronasdk,Lua,Coronasdk,在Corona SDK中,由于某些原因,我的按钮不会出现在屏幕上这是我的代码我缺少了什么 本地编写器=需要(“编写器”) 本地场景=composer.newScene() --包括科罗纳的“小部件”库 本地小部件=需要“小部件” --处理按钮事件的函数 本地功能把手按钮通风口(事件) 结束 --转发声明和其他声明 本地播放 --playBtn的“onRelease”事件侦听器 本地函数onPlayBtnRelease() 结束 --背景 本地天空=display.newImage(“start
--转发声明和其他声明 本地播放 --playBtn的“onRelease”事件侦听器 本地函数onPlayBtnRelease() 结束 --背景 本地天空=display.newImage(“startScreen/sky.png”) sky.x=display.contentWidth/2;sky.y=display.contentHeight/2 --图画 本地preston=display.newImage(“startScreen/PrestonArt.png”) 普雷斯顿:比例(0.4,0.4) preston.x=display.contentWidth/2;preston.y=display.contentHeight/2 --标签 本地learningLabel=display.newImage(“startScreen/Learning.png”) learningLabel:刻度(0.3,0.3) learningLabel.x=506;learningLabel.y=170 本地centerLabel=display.newImage(“startScreen/Center.png”) 中心标签:比例(0.3,0.3) centerLabel.x=506;中心标签y=600 功能场景:创建(事件) 本地场景组=self.view
-- Called when the scene's view does not exist.
--
-- INSERT code here to initialize the scene
-- e.g. add display objects to 'sceneGroup', add touch listeners, etc.
-- create a widget button (which will loads levelSelect.lua on release)
playBtn = widget.newButton{
defaultFile = "startScreen/Play.png", --the "default" image file
overFile = "startScreen/Play-Over.png", --the "over" image file
width=240, height=120,
onRelease = onPlayBtnRelease -- event listener function
}
playBtn.x = 300; playBtn.y = 695;
-- all display objects must be inserted into group
sceneGroup:insert( playBtn )
-- Called prior to the removal of scene's "view" (sceneGroup)
--
-- INSERT code here to cleanup the scene
-- e.g. remove display objects, remove touch listeners, save state, etc.
if playBtn then
playBtn:removeSelf() -- widgets must be manually removed
playBtn = nil
end
结束
功能场景:演出(活动)
本地场景组=self.view
本地阶段=event.phase
if phase == "will" then
-- Called when the scene is still off screen and is about to move on screen
elseif phase == "did" then
-- Called when the scene is now on screen
--
-- INSERT code here to make the scene come alive
-- e.g. start timers, begin animation, play audio, etc.
end
if event.phase == "will" then
-- Called when the scene is on screen and is about to move off screen
--
-- INSERT code here to pause the scene
-- e.g. stop timers, stop animation, unload sounds, etc.)
elseif phase == "did" then
-- Called when the scene is now off screen
end
结束
功能场景:隐藏(事件)
本地场景组=self.view
本地阶段=event.phase
if phase == "will" then
-- Called when the scene is still off screen and is about to move on screen
elseif phase == "did" then
-- Called when the scene is now on screen
--
-- INSERT code here to make the scene come alive
-- e.g. start timers, begin animation, play audio, etc.
end
if event.phase == "will" then
-- Called when the scene is on screen and is about to move off screen
--
-- INSERT code here to pause the scene
-- e.g. stop timers, stop animation, unload sounds, etc.)
elseif phase == "did" then
-- Called when the scene is now off screen
end
结束
功能场景:销毁(事件)
本地场景组=self.view
-- Called when the scene's view does not exist.
--
-- INSERT code here to initialize the scene
-- e.g. add display objects to 'sceneGroup', add touch listeners, etc.
-- create a widget button (which will loads levelSelect.lua on release)
playBtn = widget.newButton{
defaultFile = "startScreen/Play.png", --the "default" image file
overFile = "startScreen/Play-Over.png", --the "over" image file
width=240, height=120,
onRelease = onPlayBtnRelease -- event listener function
}
playBtn.x = 300; playBtn.y = 695;
-- all display objects must be inserted into group
sceneGroup:insert( playBtn )
-- Called prior to the removal of scene's "view" (sceneGroup)
--
-- INSERT code here to cleanup the scene
-- e.g. remove display objects, remove touch listeners, save state, etc.
if playBtn then
playBtn:removeSelf() -- widgets must be manually removed
playBtn = nil
end
结束
--侦听器设置 场景:addEventListener(“创建”,场景) 场景:addEventListener(“显示”,场景) 场景:addEventListener(“隐藏”,场景) 场景:addEventListener(“销毁”,场景)
返回场景我的猜测是