Store a Sprite in a Sprite?

:stare:

What is the best thing to do when storing a Sprite to call it later?

  • save it to an array (“as Sprite”) (I only need to store one value!)?
  • save the name as String in a string variable then getChildByName?
  • save it in a variable type Sprite?

three ways seam to work fine, really don’t know if there is another one, neither which one is more correct.

any ideias?
thanks

if all of them work fine, why not go with the one that’s most comfortable for you?
although, if it’s only one sprite, i think 3rd option is the best. I mean, you need to create the Sprite in the first place, why not just use that variable…

If there’s more than one, go with array.

If it’s just one, keep it as a variable and increase its scope.