# Store a Sprite in a Sprite?

**URL:** <https://forum.kirupa.com/t/store-a-sprite-in-a-sprite/265572>\
**Category:** Uncategorized\
**Created:** [July 10, 2008, 11:14am UTC](https://forum.kirupa.com/t/store-a-sprite-in-a-sprite/265572 "2008-07-10T11:14:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pensamente](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/pensamente/32/1208_2.png) [@pensamente](https://forum.kirupa.com/u/pensamente)\
**Post date:** [July 10, 2008, 11:14am UTC](https://forum.kirupa.com/t/store-a-sprite-in-a-sprite/265572/1 "2008-07-10T11:14:54Z")

</div>

: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

---

<div class="post-metadata">

**Author:** ![johnlouis](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/johnlouis/32/568_2.png) [@johnlouis](https://forum.kirupa.com/u/johnlouis)\
**Post date:** [July 10, 2008, 1:16pm UTC](https://forum.kirupa.com/t/store-a-sprite-in-a-sprite/265572/2 "2008-07-10T13:16:40Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![sekasi](https://avatars.discourse-cdn.com/v4/letter/s/5f8ce5/32.png) [@sekasi](https://forum.kirupa.com/u/sekasi)\
**Post date:** [July 10, 2008, 1:30pm UTC](https://forum.kirupa.com/t/store-a-sprite-in-a-sprite/265572/3 "2008-07-10T13:30:33Z")

</div>

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

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