I am a newbie and so I apologize if this is an obvious question. I have searched here but haven’t been able to find an adequate answer. I am trying to scroll over a map comprised of a few smaller images. I would like to be able to do that in both orientations. But it doesn’t quite work. I am completely stumped. So any and all help will be deeply appreciated. This is
my code so far:-
scrollview = widget.newScrollView{ --x = centerX, --y = centerY, top = screenTop, left = screenLeft, width = screenWidth, height = screenHeight, horizontalScrollDisabled = true, hideScrollBar = true, topPadding = 0, friction = 1.5, isBounceEnabled = false, hideBackground = true } scrollview.anchorY=0.5 scrollview.anchorX=0.5 sceneGroup:insert(scrollview) scrollview:insert(layers) for i = 1,2 do local bg1 = display.newImageRect( layers, "images/Map"..(1+(i-1)\*2)..".png", 340, 340, true ) bg1.x = centerX-200 bg1.y = centerY+360-170\*(i-1)\*2 bg1.anchorX = 0 --scrollview:insert(bg1) end for i = 1,2 do local bg1 = display.newImageRect( layers, "images/Map"..(2+(i-1)\*2)..".png", 340, 340, true ) bg1.x = centerX+124 bg1.y = centerY+360-170\*(i-1)\*2 bg1.anchorX = 0 --scrollview:insert(bg1) end end
Now I have added code to check for orientation change with Resize and then change the scrollview. width and scrollview.height accordinly but it still doesn’t work properly.