The title explains it all, how can i stop the runtime event enterframe of the touchObject in the starGroup:destroy
function.
local object = display.newPolygon( startX, -100, gameValues.vertices["star"] ) object.isStarObject = true local touchObject = display.newCircle( startX, -100, gameValues.circleRad+5 ) --object to be touched touchObject.isVisible = false touchObject.id = "star" touchObject.isHitTestable = true touchObject.isStarObject = true touchObject.touch = objectTouched touchObject.enterFrame = offScreen touchObject:addEventListener("touch", touchObject) Runtime:addEventListener( "enterFrame", touchObject ) -- put both object in there own group and in objectsGroup local starGroup = display.newGroup() starGroup:insert(touchObject) starGroup:insert(object) function starGroup:destroy() Runtime:removeEventListener("enterFrame", self) --this line should be changed display.remove( self ) self = nil end objectsGroup:insert(starGroup)