Difference between revisions of "Sprite:removeFromParent"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
'''<translate>Available since</translate>:''' Gideros 2011.6<br/>
+
'''Available since:''' Gideros 2011.6<br/>
=== <translate>Description</translate> ===
+
'''Class:''' [[Sprite]]<br/>
<translate><br />
+
 
If the sprite has a parent, removes the sprite from the child list of its parent sprite. This function is equilavent to:<br />
+
=== Description ===
<br />
+
If the sprite has a parent, removes the sprite from the child list of its parent sprite.
&lt;pre&gt;&lt;code&gt;<br />
+
<syntaxhighlight lang="lua">
function Sprite:removeFromParent()<br />
+
Sprite:removeFromParent()
local parent = self:getParent()<br />
+
</syntaxhighlight>
if parent ~= nil then<br />
+
 
parent:removeChild(self)<br />
+
This function is equilavent to:
end<br />
+
<syntaxhighlight lang="lua">
end<br />
+
function Sprite:removeFromParent()
<br />
+
local parent = self:getParent()
&lt;/code&gt;&lt;/pre&gt;<br /></translate>
+
if parent ~= nil then
<source lang="lua">
+
parent:removeChild(self)
Sprite:removeFromParent()
+
end
</source>
+
end
 +
</syntaxhighlight>
 +
 
 +
{{Sprite}}

Latest revision as of 15: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