R – Issue with flash room editor and large number of images loaded in

actionscript-3flashmemory

I created a Flash room editor for an online game. The user is able to add items to their room, which the flash loads in and creates an object for each item. For the average user this works great, but I have run across a case where a user has added 8400 items to a room and the flash can't handle it. The XML file loads up fine, but nothing shows up when it tries to load into flash. I assume this is because flash runs into a wall trying to load all of that into memory? Is there any possible way to get around this, or do I just need to limit the amount of items put into a room (2500 was about the limit I found to work).

The editor was made with Actionscript 3 if that matters.

Best Answer

Well, I guess you will never show all 8400 items simultaneously, so I would advise you to load them on demand, and then unload the ones that are not showed anymore. I guess you could eventually store them all in memory as ByteArrays (loading them with URLLoader instead of Loader), and then using Loader.loadBytes each time you need to show one.

Bear in mind that each graphical asset you show or keep in memory as such (BitmapData, Loader, etc...) will use much more RAM than if you store them as ByteArrays.

Related Topic