Sprite:removeFromParent: Difference between revisions

From GiderosMobile
No edit summary
m Text replacement - "</source>" to "</syntaxhighlight>"
 
(4 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>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
'''Class:''' [[Sprite]]<br/>
=== <translate>Description</translate> ===
 
<translate><br />
=== Description ===
If the sprite has a parent, removes the sprite from the child list of its parent sprite. This function is equilavent to:<br />
If the sprite has a parent, removes the sprite from the child list of its parent sprite.
<br />
<syntaxhighlight lang="lua">
&lt;pre&gt;&lt;code&gt;<br />
Sprite:removeFromParent()
function Sprite:removeFromParent()<br />
</syntaxhighlight>
local parent = self:getParent()<br />
 
if parent ~= nil then<br />
This function is equilavent to:
parent:removeChild(self)<br />
<syntaxhighlight lang="lua">
end<br />
function Sprite:removeFromParent()
end<br />
local parent = self:getParent()
<br />
if parent ~= nil then
&lt;/code&gt;&lt;/pre&gt;<br /></translate>
parent:removeChild(self)
<source lang="lua">
end
Sprite:removeFromParent()
end
</source>
</syntaxhighlight>
 
{{Sprite}}

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