Looping Level Help

Hi Everyone,
Im making a endless loop game, but not the typical way. Instead of having everything move past the character Im making the character move and the screen follows it with this code:

[lua]-- Camera Group –
local cameraCont = display.newGroup()
– Camera Group –

– Move Camera Left –
local function moveCameraLeft()
if character.x > 240 then
cameraCont.x = -player.x + 240
end
end
Runtime:addEventListener(“enterFrame”, moveCameraLeft)
– Move Camera Left –

– Move Camera Right –
local function moveCameraRight()
if character.x < 240 then
cameraCont.x = -player.x + 240
end
end
Runtime:addEventListener(“enterFrame”, moveCameraRight)
– Move Camera Right --[/lua]

But I’m running into a problem where I cannot get my platforms to loop back to the other side of the screen to make it seem endless. I tried using the same code I use for my background, but it didn’t work.

[lua] local function scrollBackground(self, event)
if self.x < -477 then
self.x = 477
else
self.x = self.x - self.speed
end
end

mg1.enterFrame = scrollBackground
Runtime:addEventListener(“enterFrame”, mg1)

mg2.enterFrame = scrollBackground
Runtime:addEventListener(“enterFrame”, mg2)

bg1.enterFrame = scrollBackground
Runtime:addEventListener(“enterFrame”, bg1)

bg2.enterFrame = scrollBackground
Runtime:addEventListener(“enterFrame”, bg2)[/lua]

Im guessing this code didn’t work because my platforms are not actually moving off the “Starting Screen Position”. They just look like it because my camera is the one moving. My platforms are part of the [lua]physics engine[/lua] and are [lua]“static”[/lua].

Is there a way to detect if my platforms are out of my camera’s view? [import]uid: 208120 topic_id: 35217 reply_id: 335217[/import]