Difference between revisions of "Sprite:addChildAt"

From GiderosMobile
m
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
 
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Class:''' [[Sprite]]<br/>
 
'''Class:''' [[Sprite]]<br/>
Line 6: Line 5:
 
=== Description ===
 
=== Description ===
 
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 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.
 
 
<source lang="lua">
 
<source lang="lua">
 
Sprite:addChildAt(child,index)
 
Sprite:addChildAt(child,index)
 
</source>
 
</source>
 +
 +
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 ===
 
=== Parameters ===

Revision as of 02:44, 24 September 2022

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