Sprite:removeFromParent: Difference between revisions

From GiderosMobile
No edit summary
m Text replacement - "</source>" to "</syntaxhighlight>"
 
(3 intermediate revisions by 2 users not shown)
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 />
<syntaxhighlight lang="lua">
<br />
Sprite:removeFromParent()
&lt;pre&gt;&lt;code&gt;<br />
</syntaxhighlight>
function Sprite:removeFromParent()<br />
 
local parent = self:getParent()<br />
This function is equilavent to:
if parent ~= nil then<br />
<syntaxhighlight lang="lua">
parent:removeChild(self)<br />
function Sprite:removeFromParent()
end<br />
local parent = self:getParent()
end<br />
if parent ~= nil then
<br />
parent:removeChild(self)
&lt;/code&gt;&lt;/pre&gt;<br /></translate>
end
<source lang="lua">
end
Sprite:removeFromParent()
</syntaxhighlight>
</source>
 
{{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