2.2.1,定时器里面不能执行动画问题

local cache = CCSpriteFrameCache:sharedSpriteFrameCache()
cache:addSpriteFramesWithFile("c.plist", "c.png")
local sprite = CCSprite:createWithSpriteFrameName("c0000")
sprite:setPosition(ccp(100,100))
local animFrames = CCArray:createWithCapacity(15)
for i = 1,25 do
    local frame = cache:spriteFrameByName(string.format("c%04d", i))
    animFrames:addObject(frame)
end   
CCDirector:sharedDirector():getScheduler():scheduleScriptFunc(
  function()
    local animation = CCAnimation:createWithSpriteFrames(animFrames, 0.3)
    sprite:runAction(CCAnimate:create(animation))
  end
  , 4, false)
self.layer:addChild(sprite)

我想在定时器里执行某个动画,但是它确不执行,谁知道这个是什么原因呢

虽然我不懂lua 但是这句话 local sprite = CCSprite:createWithSpriteFrameName(“c0000”) 是加载给他一张精灵帧吧c0000后面没有png么?

确实是没有的,但是确实图片确实出来了,如果不用定时器,直接执行
local animation = CCAnimation:createWithSpriteFrames(animFrames, 0.3)
sprite:runAction(CCAnimate:create(animation))
是OK的

应该是Scheduler的问题
local s2 = CCScene:create()
local function wait()
CCDirector:sharedDirector():pushScene(s2)
end

local sharedScheduler = CCDirector:sharedDirector():getScheduler()
local handle
handle = sharedScheduler:scheduleScriptFunc(
function()
sharedScheduler:unscheduleScriptEntry(handle)
wait()
end, 3, false)
这样写,就会发现s2在lua里不会为nil 而在pushScene的C里面的参数就为Null了,这个是为什么呢