Difference between revisions of "Sprite:addChildAt"

From GiderosMobile
Line 2: Line 2:
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 
=== Description ===
 
=== Description ===
<br />
+
<translate><br />
 
Adds a sprite as a child to this sprite. The child is<br />
 
Adds a sprite as a child to this sprite. The child is<br />
 
added at the index position specified. Indices start from 1.<br />
 
added at the index position specified. Indices start from 1.<br />
Line 10: Line 10:
 
the sprite is removed from the child list of the other sprite<br />
 
the sprite is removed from the child list of the other sprite<br />
 
and then added to this sprite.<br />
 
and then added to this sprite.<br />
<br />
+
<br /></translate>
 
<source lang="lua">
 
<source lang="lua">
 
  Sprite:addChildAt(child,index)
 
  Sprite:addChildAt(child,index)
 
</source>
 
</source>
 
=== Parameters ===
 
=== Parameters ===
'''child''': (Sprite) The child sprite to add. <br/>
+
'''child''': (Sprite) <translate>The child sprite to add.</translate> <br/>
'''index''': (number) The index position to which the child is added. <br/>
+
'''index''': (number) <translate>The index position to which the child is added.</translate> <br/>

Revision as of 14:33, 23 August 2018

Available since: Gideros 2011.6

Description


Adds a sprite as a child to this sprite. The child is
added at the index position specified. Indices start from 1.

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.

 Sprite:addChildAt(child,index)

Parameters

child: (Sprite) The child sprite to add.
index: (number) The index position to which the child is added.