ボタンに触れるたびに力を加えて適用するボタンがあります。これがメモリリークを防ぐにはどうすればよいですか?
シーンごとに変更するためにディレクター クラスを使用しています。コードは次のとおりです。
-- Fire the rocket from the jet position
local function fireTheRocket(event)
if event.phase == "ended" then
local fireBall = display.newImage( "rocket.png")
fireBall.x = jet.x;
fireBall.y = jet.y;
GUI:insert(fireBall);
physics.addBody(fireBall, "dynamic")
fireBall:applyForce( 1000, 0, fireBall.x, fireBall.y )
end
end
fireBtn:addEventListener("touch", fireTheRocket)