Difference between revisions of "Sprite:removeFromParent"

From GiderosMobile
Line 2: Line 2:
 
'''Available since:''' Gideros 2011.6<br/>
 
'''Available since:''' Gideros 2011.6<br/>
 
=== Description ===
 
=== Description ===
<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 />
 
If the sprite has a parent, removes the sprite from the child list of its parent sprite. This function is equilavent to:<br />
 
<br />
 
<br />
Line 13: Line 13:
 
end<br />
 
end<br />
 
<br />
 
<br />
&lt;/code&gt;&lt;/pre&gt;<br />
+
&lt;/code&gt;&lt;/pre&gt;<br /></translate>
 
<source lang="lua">
 
<source lang="lua">
 
  Sprite:removeFromParent()
 
  Sprite:removeFromParent()
 
</source>
 
</source>

Revision as of 13:33, 23 August 2018

Available since: Gideros 2011.6

Description


If the sprite has a parent, removes the sprite from the child list of its parent sprite. This function is equilavent to:

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

</code></pre>

 Sprite:removeFromParent()