Yea I thought about just iterating through part of the array and then trying to detect when someone scrolls down a certain bit and then run through a little bit more of the array…but then I was thinking this might not produce the smoothest scrolling results as I was thinking it would pause briefly while the array iterated again.
Here is the code I currently run through the array:
for i=1,#data do matchCounterI = matchCounterI + 1 local id = data[i].id local name = data[i].name local playStatusText = "INVITE" if (data[i].installed) then playStatusText = "PLAY" end local backgroundMiddleC = display.newImageRect( "scrollimageMiddle.png", 300, 40 ) backgroundMiddleC.x = 160 backgroundMiddleC.y = 13 + (40 \* turnsCounter) scrollView:insert(backgroundMiddleC ) local fbName = display.newText( name, 0, 0, native.systemFontBold, 14 ) fbName:setTextColor( 0 ) fbName:setReferencePoint( display.CenterLeftReferencePoint ) fbName.x, fbName.y = 40, 5 + (40 \* turnsCounter) scrollView:insert( fbName ) if (data[i].installed) then local fbDesc = display.newText( "Start a new game!", 0, 0, native.systemFont, 9 ) fbDesc:setTextColor( 0 ) fbDesc:setReferencePoint( display.CenterLeftReferencePoint ) fbDesc.x, fbDesc.y = 40, 21 + (40 \* turnsCounter) scrollView:insert( fbDesc ) else local fbDesc = display.newText( "Invite to Movie Trivia Match Up!", 0, 0, native.systemFont, 9 ) fbDesc:setTextColor( 0 ) fbDesc:setReferencePoint( display.CenterLeftReferencePoint ) fbDesc.x, fbDesc.y = 40, 21 + (40 \* turnsCounter) scrollView:insert( fbDesc ) end playGameLabel[matchCounterI] = display.newImageRect( "blankButton.png", 50, 25 ) playGameLabel[matchCounterI].x = 270 playGameLabel[matchCounterI].y = 13 + (40 \* turnsCounter) playGameLabel[matchCounterI].id = id scrollView:insert( playGameLabel[matchCounterI] ) local playGameLabelText = display.newText( playStatusText, 0, 0, native.systemFontBold, 12 ) playGameLabelText:setTextColor( 0 ) playGameLabelText:setReferencePoint( display.CenterReferencePoint ) playGameLabelText.x, playGameLabelText.y = 270, 13 + (40 \* turnsCounter) scrollView:insert( playGameLabelText ) playGameLabel[matchCounterI]:addEventListener( "touch", playGameLabelTouch ) turnsCounter = turnsCounter + 1 end
Thanks