简体   繁体   English

设备上的Corona SDK Director类错误

[英]Corona SDK Director class error on device

I have a problem with Director v 1.4 when testing on the device (iPhone). 在设备(iPhone)上进行测试时,Director v 1.4出现问题。 The simulator is not showing any errors, but they come up on the device. 模拟器没有显示任何错误,但是会出现在设备上。 Here is the error: 这是错误:

slotMachine[1206] <Warning>: Runtime error
?:0: attempt to call method 'insert' (a nil value)
stack traceback:
    [C]: in function 'insert'
    ?: in function 'changeScene'
    ?: in function <?:13>
    ?: in main chunk

And here is the main.lua: 这是main.lua:

    display.setStatusBar( display.HiddenStatusBar )



local director = require("director")



local mainGroup = display.newGroup()



local main = function ()


    mainGroup:insert(director.directorView)



    director:changeScene("menu1", "overFromBottom")



    return true
end


main()

And this is menu1.lua: 这是menu1.lua:

    module(...,package.seeall)



new = function ( params )

    local GGData = require( "GGData" )

local _W = display.contentWidth --Width and height parameters
local _H = display.contentHeight


    local localGroup = display.newGroup()
local box = GGData: load( "credits" )
local background = display.newImageRect("images/machine_bg.png",640,960)
background.x = _W*0.5; 
background.y = _H*0.800;

local currentBalance = display.newText("Current Balance:\n$"..box.credits, 0,0,400,0, "Quicksand", 25)
currentBalance:setTextColor(44, 62, 80)
currentBalance:setReferencePoint(display.CenterLeftReferencePoint)
currentBalance.x = _W - 265; currentBalance.y = _H *0.17;


localGroup:insert (background)
localGroup:insert (currentBalance)





    return localGroup

end

Director is a quite old library; 导演是一个很老的图书馆。 you will want to start using Storyboard. 您将要开始使用Storyboard。 Though it may seem more difficult to begin with, in the end, you'll be glad you did it - it's officially supported by Corona (meaning active development as the SDK is upgraded) and more powerful. 尽管开始时似乎比较困难,但最后还是会感到高兴-它得到了Corona的正式支持(意味着随着SDK的升级,将进行积极的开发)并且功能更强大。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM