Which method do you expect would have better performance when stressed? It's a 2D tile map where the camera has view of a small portion of the map. As I pan up/down/left/right, should I be adding and removing tiles from the stage as needed? or have them loaded, offstage, and just change their x/y coords as needed?
I'm using AS3 to code this and I have it working fine. And I know it's not wise to try to optimize early, but since I'm very new at this, I thought maybe someone already knows if one is usually better.
In a case like this, you are going to want to Pool your world tiles. The idea is to pre-load a fixed amount of tiles that you will be re-using during the rendering of your world.
When setting a tile into the world, you would typically set certain properties such as its position and texture. The rest of the object is already ready to go in memory.
The idea is to try to retain some tiles on the screen and only return them into your Pool when they are far enough. This way, if you revisit an area that was already set, you probably do not have to process as many tiles.