Hey Corona-users,
At the moment I’m working on an application for my internship company but I am kinda stuck on something.
My app involves displaying the portfolio of an advertising agency with the possibility of switching between big projects, news-items and small portfolio-items. At this moment the application checks if the user already got the necessary images for the desired items and if not, it downloads them using the network.download function. Now, when the user is at the news-item screen which starts the download of the needed images and he switches to a different scene before the download has finished and switches back to the news-item screen it becomes all buggy because the downloaded images can’t be inserted into the imgGroup anymore.
To make things a bit clear:
- The user start the app and comes out at the news-page. This starts the download of the news-images which need to be shown and aren’t already in the documentsDirectory.
- The user switches to the projects-page and after that quickly switches back to the news-page before the download has finished.
- Now, while back on the news-page, the download finishes which continues the networklistener. Inside the networklistener it creates the image (display.newImageRect) and after that it inserts it into an imgGroup. The problem is now because of the scene switching it can’t insert the image in the imgGroup (apparently a nil value).
How am I able to fix this? I managed to do nothing inside the networklistener while the user is not on the right scene but it really becomes messy when the user leaves the news-page and comes back on it before the download has finished…
Any help on this is really appreciated.
If any code is needed tell me. I didn’t include it right away because of my code being a real mess after struggling with this for days. [import]uid: 189912 topic_id: 34652 reply_id: 334652[/import]