Hey, I’m currently working on making a side-scroller and came across a problem when scrolling tiles.
I use an object to hold information and an mc
Is there anyway I can change the variable name of an object or movie-clip?
Reason: I want to be able to access certain tiles from the scroller quickly by using the x&y coordinates of the tile.
ie:
var obj:Object = new Object();
for(i = 0; i != 10; i++) //x-coord
for(j = 0; j != 10; j++) //y-coord
obj["_"+i+"_"+j] = new MovieClip(); //accessing obj's mc using coordinates
Then later when I want to move a particular movie-clip over to represent a new tile on the screen, I just move a previous unneeded tile over so that I won’t have to delete the old one and create a new movie-clip and fill it with information. But the problem comes in this. I can’t change the obj name to anything else when it becomes a new tile with coordinates i and j, I can’t access it by going obj[""+i+""+j] anymore. I have to use it’s old name obj[""+oldI+""+oldJ].
Does anyone have a way around this? Maybe my way of storing variables is bad?
I hope my explanation was clear.
Thanks much,
Fydus