Getting a display object to move right using the enterframe event

I’m trying to get a display object to move right across the screen on its own when I touch the “fooRight” object. Below is the snippet of the code that I’m trying to fix. I assume that the function activateRight is the issue. 

function activateRight () foo.x = foo.x + 10 if foo.x \> 320 then foo.x = 0 end end function touchRight(event) if event.phase == "began" then Runtime:addEventListener("enterframe", activateRight) elseif event.phase == "moved" then Runtime:addEventListener("enterframe", activateRight) end end fooRight:addEventListener("touch", touchRight)

I think the main problem is you put “enterframe”, should be “enterFrame”.   Also note you don’t need to place the Runtime event listener under both “began” and “moved”.  “moved” is always preceded by “began”, so if you touch the screen and move your finger you are essentially telling it to add the event listener twice.  

I think the main problem is you put “enterframe”, should be “enterFrame”.   Also note you don’t need to place the Runtime event listener under both “began” and “moved”.  “moved” is always preceded by “began”, so if you touch the screen and move your finger you are essentially telling it to add the event listener twice.