Display objects visible on-screen in a scrollView?

Hi,

I have a scrollView which contains loads of images to be loaded over the network. To start with I just insert a rectangular area (a placeholder rectangle with the correct dimensions) for each image. The goal is to only start downloading images which are visible on-screen (in the scrollView) at the moment. If an image placeholder rectangle no longer is on-screen I would like to pause the downloading of the image.

Short question: I need to detect if a display object is visible on screen in a scrollView. Is this possible?

I have tested with brute force ideas but they are too brutal. Any ideas?

Cheers

/Joakim

I did a example (3 actually) that cover part of this.

https://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2014/10/Texture%20Memory%20Management

Please note, this uses SSK2.  However, you may still be able to get part of what you need from this file:

https://github.com/roaminggamer/RG_FreeStuff/blob/master/AskEd/2014/10/Texture%20Memory%20Management/onScreen.lua

Thanks! I will experiment with this.

Cheers

/Joakim

Note: My answer is about detecting the on-screen-ness of something.  I don’t think you can pause a network request.  Once it is sent it is either coming back or not.

You can however, modify your call back to check if the object is on-screen and ignore the response for objects that are no longer visible.

I know. It is not possible to pause a network.download() call but I have experimented with this:
https://forums.coronalabs.com/topic/67507-resuming-a-cancelled-networkdownload/

I did a example (3 actually) that cover part of this.

https://github.com/roaminggamer/RG_FreeStuff/tree/master/AskEd/2014/10/Texture%20Memory%20Management

Please note, this uses SSK2.  However, you may still be able to get part of what you need from this file:

https://github.com/roaminggamer/RG_FreeStuff/blob/master/AskEd/2014/10/Texture%20Memory%20Management/onScreen.lua

Thanks! I will experiment with this.

Cheers

/Joakim

Note: My answer is about detecting the on-screen-ness of something.  I don’t think you can pause a network request.  Once it is sent it is either coming back or not.

You can however, modify your call back to check if the object is on-screen and ignore the response for objects that are no longer visible.

I know. It is not possible to pause a network.download() call but I have experimented with this:
https://forums.coronalabs.com/topic/67507-resuming-a-cancelled-networkdownload/