Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
What is best practice for clearing/redrawing shapes? — Gideros Forum

What is best practice for clearing/redrawing shapes?

ondesicondesic Member
edited July 2012 in General questions
I am using the following code to recreate a line. However, I am worried that I am not doing it right. I don't want to cause memory leaks:
local line = Shape.new()
	line:setLineStyle(5, 0x000000, 1)
	line:beginPath()
	line:moveTo(100,100)
	line:lineTo(200, 200)
	line:endPath()
 
stage:addChild(line)
 
line.clear()
 
line:setLineStyle(5, 0x000000, 1)
	line:beginPath()
	line:moveTo(100,100)
	line:lineTo(300, 250)
	line:endPath()
 
stage:addChild(line)
Is this correct, or do I need to remove the child from stage first?

Thanks

Comments

Sign In or Register to comment.