Hello,
I want to make a big levels (the objects in the level can get out of the screen).
I tryed to make a scrollView and i got this error:
This is the main.lua:
local widget = require "widget" local myrect local function scrollviewListener(event) display.getCurrentStage():setFocus(myrect) end local myscrollview = widget.newScrollView{listener = scrollviewListener} myrect = display.newRect(0, 0, display.contentWidth, 68) myrect:setFillColor(255,100,100,255) myscrollview:insert(myrect) local function ontouch(event) if event.phase == "ended" then print("event ended") end end myrect:addEventListener( "touch", ontouch )
This is the error:
bad argument #4 to ‘newRect’ (number expected, got nil)
message
stack traceback:
?: in function <?:218>
[C]: ?
[C]: in function ‘newRect’
?: in function ‘?’
?: in function <?:484>
(tail call): ?
…\mygame(default)\mygame\main.lua:7: in main chunk
What is the problem?
Thanks!