Big level (scrollView)

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!

I’m not familiar with scroll-views, but if you are wanting a sort of ‘camera’ that would follow your player around a larger-than-display-size level, then I recommend utilizing a camera module.
I use Caleb P’s camera module and it works perfectly! link

-Saer
 

Most likely it’s because you are not providing a width and height to the scrollView.  Please see 

http://docs.coronalabs.com/daily/api/library/widget/newScrollView.html

and make sure you’re providing all required parameters.

Thanks

Rob

I’m not familiar with scroll-views, but if you are wanting a sort of ‘camera’ that would follow your player around a larger-than-display-size level, then I recommend utilizing a camera module.
I use Caleb P’s camera module and it works perfectly! link

-Saer
 

Most likely it’s because you are not providing a width and height to the scrollView.  Please see 

http://docs.coronalabs.com/daily/api/library/widget/newScrollView.html

and make sure you’re providing all required parameters.

Thanks

Rob