【发布时间】:2015-07-01 20:21:35
【问题描述】:
我从 Corona SDK 收到以下错误消息:尝试调用字段“ImageSheet”(一个 nil 值)堆栈回溯。有人能指出错误吗?
local ISPar = {
width = 2541,
height = 264,
numFrames = 7
}
local ImageSheet = graphics.ImageSheet("Apus.png, ISPar")
local ApusSequenceData = {
{name = "fly", frames {1,2,3,4,5,6,7}, time = 800, loopCount = 0}
}
local Apus = display.newSrpite(ImageSheet, ApusSequenceData)
Apus.x = display.contentWidth/2
Apus.y = display.contentHeight/2
Apus:play()
【问题讨论】:
-
应该是
graphics.newImageSheet,也缺少=用于表中的框架键。 -
您还需要修正参数中的引号 (
"Apus.png", ISPar) 和display.newSprite中的拼写错误。避免对变量使用大写的名称,因为它们可能会影响类名,否则会非常规。