Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Changing the parent of a sprite [solved] — Gideros Forum

Changing the parent of a sprite [solved]

Tom2012Tom2012 Guru
edited December 2012 in General questions
Been trying to figure out how to change the parent of a sprite.

After some playing around today I think I've got it.

If you use addChild on a sprite that's already a child of another sprite, does it then cease being a child of the former sprite and become a child of the one you just specified?

Hope that didn't sound like jibberish! :-)

EDIT: Yes, this is in the reference.

"Sprites can have only one parent. Therefore if you add a child object that already has a different sprite as a parent, the sprite is removed from the child list of the other sprite and then added to this sprite."

Likes: ar2rsawseen

+1 -1 (+1 / -0 )Share on Facebook

Comments

  • Don't forget that you can save the index of your child before adding it to another parent.
    Sprite:getChildIndex(child)
    Returns the index of the specified child sprite.
    That will come in handy when you need to return your sprite/child to his original parent.
    twitter@TheWindApps Artful applications : The Wind Forest. #art #japan #apps
Sign In or Register to comment.