Difference between revisions of "Sprite:removeFromParent"

From GiderosMobile
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 />
+
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. This function is equilavent to:<br />
 
<br />
 
&lt;pre&gt;&lt;code&gt;<br />
 
function Sprite:removeFromParent()<br />
 
local parent = self:getParent()<br />
 
if parent ~= nil then<br />
 
parent:removeChild(self)<br />
 
end<br />
 
end<br />
 
<br />
 
&lt;/code&gt;&lt;/pre&gt;<br /></translate>
 
 
<source lang="lua">
 
<source lang="lua">
Sprite:removeFromParent()
+
Sprite:removeFromParent()
 +
</source>
 +
 
 +
This function is equilavent to:
 +
<source lang="lua">
 +
function Sprite:removeFromParent()
 +
local parent = self:getParent()
 +
if parent ~= nil then
 +
parent:removeChild(self)
 +
end
 +
end
 
</source>
 
</source>
  
 
{{Sprite}}
 
{{Sprite}}

Revision as of 19:08, 7 February 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