Hmm, not having much luck here - I keep crashing the simulator.
I’ve implemented my own lazy load, it basically takes a scrollView and an index as parameters, and loads the n-1,n and n+1 images. It also scans through any other child objects outside of that range and removes them.
I’ve tried scrollView:remove(index) and scrollView.content:remove(index) but nothing works.
Here is my code:
[code]
– Loads the current, previous and next images in a scroll view
function loadScrollImages(scrollView,index)
print(“ScrollView has “…scrollView.numChildren…” children”)
print(“ScrollView.content has “…scrollView.content.numChildren…” children”)
– Load new images
for i=index-1,index+1 do
if(i>0 and i local partImage = display.newImageRect(“assets/images/parts/”…scrollImages[i]…".png",320,144)
partImage:setReferencePoint(display.TopLeftReferencePoint)
scrollView.content:insert(partImage)
partImage.x = ((i-1) * partImage.width)
partImage.y = 0
end
end
– Unload old images
for i=1,scrollView.content.numChildren do
if(iindex+1) then
– What goes here???
end
end
end
[/code] [import]uid: 140429 topic_id: 24278 reply_id: 106787[/import]