Difference between revisions of "Sprite:addChildAt"

From GiderosMobile
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
 
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
 
'''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
=== <translate>Description</translate> ===
+
 
<translate><br />
+
=== Description ===
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 added at the index position specified. Indices start from 1.
added at the index position specified. Indices start from 1.<br />
+
 
<br />
+
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.
Sprites can have only one parent. Therefore if you add a child<br />
 
object that already has a different sprite as a parent,<br />
 
the sprite is removed from the child list of the other sprite<br />
 
and then added to this sprite.<br />
 
<br /></translate>
 
 
<source lang="lua">
 
<source lang="lua">
Sprite:addChildAt(child,index)
+
Sprite:addChildAt(child,index)
 
</source>
 
</source>
=== <translate>Parameters</translate> ===
+
 
'''child''': (Sprite) <translate>The child sprite to add.</translate> <br/>
+
=== Parameters ===
'''index''': (number) <translate>The index position to which the child is added.</translate> <br/>
+
'''child''': (Sprite) the child sprite to add<br/>
 +
'''index''': (number) the index position to which the child is added<br/>
  
 
{{Sprite}}
 
{{Sprite}}

Revision as of 10:11, 1 September 2020


Available since: Gideros 2011.6
Class: Sprite

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