I have a dynamic side-scrolling image viewer that loads many images (maybe up to a hundred). The user can swipe between them and select one.
As of now, before the user can interact, all the images are pre-loaded and placed in a wide display container (mostly off screen obviously). This is not so smart I guess as if this image collection grows very large then I could be presented with memory issues.
I could avoid this by simply loading a few images to the left and right of the ‘focus’ image and remove the ones outside of that. This would be fine if the user was swiping one at a time. The problem I have is that fast swipes will send the image container flying fast… again I could increase this pre-loaded amount to 10, but then another problem will likely occur. If I tell the program at any stage: “hey load another ten please”, the user interaction ( touching and animation ) will surely stutter or pause while these load making the whole experience a little unprofessional.
Async image loading would fix all of that. i.e start the loading AND allow the graphics to move about at the same time. I think we can do it with http image requests… but not when loading from a local directory? Is there a way to ‘hack’ this so I could async load from a local directory using the http api?
Hope I communicated my problem and any advice would be appreciated. I know it’s probably a simple “no, it can’t do that”. Hopefully it’s something we can have added in the future. No fancy multithreading or anything - just assets being loaded into memory without disrupting Runtime “enterFrames” or “touch” events.
I love optimizing memory use, and I also love offering a smooth interactive experience.