# getChildAt() only grabbing every other sprite....?

**URL:** <https://forum.kirupa.com/t/getchildat-only-grabbing-every-other-sprite/331650>\
**Category:** flash\
**Created:** [September 17, 2013, 8:43pm UTC](https://forum.kirupa.com/t/getchildat-only-grabbing-every-other-sprite/331650 "2013-09-17T20:43:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![GeekTweak\_0](https://avatars.discourse-cdn.com/v4/letter/g/b5ac83/32.png) [@GeekTweak\_0](https://forum.kirupa.com/u/GeekTweak_0)\
**Post date:** [September 17, 2013, 8:43pm UTC](https://forum.kirupa.com/t/getchildat-only-grabbing-every-other-sprite/331650/1 "2013-09-17T20:43:07Z")

</div>

The following function is in the child class of the parent class accessing the function:

public function cloneBack():Sprite  
{  
var returnSprite:Sprite = new Sprite();

```
        for(var i=0;i&lt; **objects.numChildren** ;i++)
        {
            returnSprite.addChild(**objects.getChildAt(i)**);
        }
        return returnSprite as Sprite;
    }

```

So the returned sprite only returns every other sprite within the parent sprite \*\*objects. \*\*The weird thing is that whenever i access the children using getChildAt(1,2,3,4,etc.) as opposed to using the loop, it does fine. Why would this happen? thanks.
