Difference between revisions of "Sprite:addChildAt"

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

Latest revision as of 14:33, 13 July 2023

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.

Sprite:addChildAt(child,index)

Sprites can only have 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.

Parameters

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