In the following code the removeEventListener is not removing the enterframe event and i get error when i change the scene and tells me that the enterFrame is still running… Please Help!!!
function obj:enterFrame( event ) if(obj ~= nil and obj.ground ~= nil)then if (obj.y \> obj.ground) then --print("obj.y \<= obj.ground") obj.y = obj.ground obj.gravityScale = 0 obj:setLinearVelocity(0, 0) Runtime:removeEventListener("enterFrame", obj) obj:setSequence( "hit4" ) obj:play() if(obj == player)then obj:addEventListener( "sprite", playerHitAnim ) end end else Runtime:removeEventListener("enterFrame", obj ) end --Sck.sendUpdate(obj.x, obj.y, obj.xScale, obj.sequence, obj.frame) end Runtime:addEventListener ( "enterFrame", obj )