The example code for widget.newScrollView() creates an image to insert into the scrollView, at the end, but it refers to bg, which does not exist:
background.x = bg.contentWidth * 0.5
background.y = bg.contentHeight * 0.5
So the result is an error:
attempt to index global ‘bg’ (a nil value)
Is the use of bg a typo? Isn’t this supposed to be display instead of bg?
The example code with the problem is here:
http://docs.coronalabs.com/api/library/widget/newScrollView.html