07-22-2011 02:06 PM
Not really a problem, more of a request for feedback.
I have currently built a grid based image gallery which uses next/back buttons to take you through the pages of images. Ideally I would like to achieve a gallery which had continuous scrolling functionality, just like the native pictures application that comes with the device, so that the users can 'drag' the gallery of images across the screen, loading the new images as the gallery is moved.
I don't want to load all of the images at once as each gallery will have hundreds of images, I would rather only load the images which are within the viewing area of the screen. Does anyone know of a way to deal with this? I didn't know if I could write a custom cell rendererfor each 'grid page' in the gallery and then use the imageCache Class like below:
Any ideas or suggestions would be appreciated.
07-22-2011 06:46 PM
I've done something similar in my app (http://appworld.blackberry.com/webstore/content/49
Take a look at Lee Brimelow's excellent tutorial:
He uses static images embedded into the .swf for simplicity, but it could easily be modified to use an ImageCache or other technique. The only difficuly is that you'll have ensure that the image - or a correctly sized placeholder - is available when it is needed. If your images are of mixed size & aspect ratio that may be difficult.
07-23-2011 01:08 PM
I wrote my own photo scroller for my app and was trying to approach it in the same way as you. Have you checked out the scrollRect class?
it defines a scrollrectangle where your graphics are only rendered when they enter the bounds of the rectangle. I found that it is less CPU intensive but it isn't quite as smooth as if you load all the images simultaneously. For the best results you need to set the cachasBitmap value to true for your display objects that you are scrolling.
07-25-2011 05:05 PM
Thanks for your suggestions, least I have a starting point and some things to try.
I'll try to put together a simple example and I'll try post the source back for some feedback if that's ok.
07-29-2011 04:10 AM
I managed to get a simple example working by using a TileList with a custom cell renderer and ImageCache for the images inside of the renderer. It seems to work well, now I just need to figure out a way to detect when the end of the TileList is reached so I can load anothet set of images (I'm loading in batches of 30).
I'll try post the source up later today.