Aw, come on, you can do better than to introduce a "screenshotNames" property in the sprite constructor ("class")! You know, the sprite object (as well as the stage) actually *knows* all its costumes and therefore it also already knows *every* costume name, so keeping track of "screenshotNames" is really redundant.

So what you could do is, to scan the names of all costumes for an object (sprite or stage) and, if a same-named one already exists, modify its name slightly. This might create costume names like the following:

    costume
    costume1
    costume11
    costume111
    ....

which is probably not really what you want (but it's easy to implement). Instead you could also parse the costume names for trailing numbers, and only compare the non-numerical part, which would make it easy to increment a counter.

Make sense?