I'm not entirely sure what error you're getting, but if I were to take a
wild guess, I'd say the problem is that your sprite doesn't have enough
children for you to add anything at index 2.

For instance, if your sprite only had 1 child, it would occupy index 0 of
your sprite, meaning you'd only be allowed to add children at index 0 and 1.
(Don't forget that Flash starts counting at 0)

If you're looking to add a child to the "top layer" of your sprite, probably
the better way of doing this would be...

sparent.addChildAt(childSprite, sparent.numChildren - 1);

Good luck!

--Todd




On Thu, Feb 25, 2010 at 9:09 AM, Lehr, Theodore
<ted_l...@federal.dell.com>wrote:

> How would I do the following:
>
> function fname(sparent:Sprite) {
>    sparent.addChildAt(childSprite,2);
> }
>
> fname(spriteParent);
>
> It does not seem to like this....
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to