Difference between revisions of "Sprite:removeFromParent"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
Line 5: Line 5:
 
=== Description ===
 
=== Description ===
 
If the sprite has a parent, removes the sprite from the child list of its parent sprite.
 
If the sprite has a parent, removes the sprite from the child list of its parent sprite.
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
Sprite:removeFromParent()
 
Sprite:removeFromParent()
 
</source>
 
</source>
  
 
This function is equilavent to:
 
This function is equilavent to:
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
function Sprite:removeFromParent()
 
function Sprite:removeFromParent()
 
local parent = self:getParent()
 
local parent = self:getParent()

Revision as of 15:31, 13 July 2023

Available since: Gideros 2011.6
Class: Sprite

Description

If the sprite has a parent, removes the sprite from the child list of its parent sprite. <syntaxhighlight lang="lua"> Sprite:removeFromParent() </source>

This function is equilavent to: <syntaxhighlight lang="lua"> function Sprite:removeFromParent() local parent = self:getParent() if parent ~= nil then parent:removeChild(self) end end </source>