Difference between revisions of "Sprite:removeFromParent"

From GiderosMobile
m (Text replacement - "<source" to "<syntaxhighlight")
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
Line 7: Line 7:
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
Sprite:removeFromParent()
 
Sprite:removeFromParent()
</source>
+
</syntaxhighlight>
  
 
This function is equilavent to:
 
This function is equilavent to:
Line 17: Line 17:
 
end
 
end
 
end
 
end
</source>
+
</syntaxhighlight>
  
 
{{Sprite}}
 
{{Sprite}}

Latest revision as of 14:33, 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.

Sprite:removeFromParent()

This function is equilavent to:

function Sprite:removeFromParent()
	local parent = self:getParent()
	if parent ~= nil then
		parent:removeChild(self)
	end
end