This code work without timer cancel code
“”""""""""""""""""" Here is my code “”""""""""""""""""""""""""""""""""""""""
local storyboard = require(“storyboard”); local scene = storyboard.newScene()
function scene:createScene(e)
local view = self.view;
local background = display.newRect(0,0,_W,_H);
background:setFillColor(0, 0 ,0);
local unilever = display.newImageRect(“images/unilever.png”, _W , _H);
unilever.x = _W * 0.5;
unilever.y = _H * 0.5;
unilever.alpha = 0;
local tmr = timer.performWithDelay(100, function(e)
unilever.alpha = unilever.alpha + 0.04;
if(e.count == 25) then
timer.cancel(tmr);
tmr = nil;
print(“timer finished”);
end
end
, 25)
end
scene:addEventListener(“createScene”, scene); scene:addEventListener(“exitScene”, scene);
return scene; “”"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
“”""""""""""""""“Error Message”""""""""""""""""""""""""""""""""""""""’
?:0: attempt to index a nil value message stack traceback: ?: in function [C]: ? ?: in function ‘cancel’ c:\users\sulaiman\appdata\roaming.luaglider28\dev\projectbuilds\myproject200(builds)\myproject200(default)\myproject200\StartUnilever.lua:23: in function ‘_listener’ ?: in function ?: in function “”"""""""""""""""""’"""""""""""""""""""""""""""""""""""""""""""""""""""