Glad it was useful. I'll take a look at what your capx tomorrow.
I thought of a simple way to save changes to the array.
Basically just change the tiles on the tilemap like normal, but when you do, set a Boolean variable to save that tilemap.
When that Boolean is set and before moving a tilemap that moved off screen, store that tilemap in a dictionary object.
With this key
X&" "y
And this value:
Tilemap.asjson
Then after moving check if the current tilemap position is in the dictionary. If it is, load that json. If it isn't call update.
That way only tilemaps that are changed are saved.
Enemies could be tricky if they're off screen since they would no longer have a tilemap to interact with. Two ways around that come to mind. One would be to put the object to sleep if offscreen. Another would be to maintain some tilemaps around the enemies, however this could prove complex.