Help with Moving Objects On/Off Screen

[lua]-------------------------------------------------------------------------------------------------------------------
–THE NEXT BUTTON–

local widget = require(“widget”)

–Function to handle button events
local function handleNextButtonEvent(event)
local phase = event.phase
if “ended” == phase then
transition.moveTo(automonousGroup, {y = -sHeight,})
transition.moveTo(teleOpGroup, {y = -sHeight,} )
print(“Pressed and released!”)

end
end
local nextButton = widget.newButton
{
left = sWidth*0.75,
top = sHeight*0.015,
width = sWidth*0.09,
height = sHeight*0.07,
defaultFile = “whiteButtonOff.png”,
overFile = “whiteButtonPressed.png”,
label = “Next”,
labelColor =
{
default = {0, 0 , 255},
over = {0, 0, 255},
},
emboss = true,
onEvent = handleNextButtonEvent,
}
nextButton._view._hasAlphaFade = false
automonousGroup:insert(nextButton)


–THE BACK BUTTON–

local function handleBackButtonEvent(event)
local phase = event.phase
if “ended” == phase then
transition.moveTo(automonousGroup, {y = sHeight/-1,} )
transition.moveto(teleOpGroup, {y = sHeight/-1,})
print(“Pressed and released!”)
end
end
local backButton = widget.newButton
{
left = sWidth*0.25,
top = sHeight*0.015+sHeight,
width = sWidth*0.09,
height = sHeight*0.07,
defaultFile = “whiteButtonOff.png”,
overFile = “whiteButtonPressed.png”,
label = “Back”,
labelColor =
{
default = {0, 0 , 255},
over = {0, 0, 255},
},
emboss = true,
onEvent = handleNextButtonEvent,
}
nextButton._view._hasAlphaFade = false
teleOpGroup:insert(backButton)[/lua]

Here is my code for my buttons. Basically what I want to do is remove the first page off the screen, then i have the already off-screen objects come in. Only problem is I don’t know how to reverse this in the BACK button so they return back to their original positions. Thanks in advance!

Are you using a scene manager like Composer? If not, I would suggest you consider it. Please see:

https://docs.coronalabs.com/guide/system/composer/index.html

Rob

I thought composer was a rather bit much, but you can resolve this topic as I found a solution. Just set y = 0 and it would reset my “pages”. Thanks anyway!

Are you using a scene manager like Composer? If not, I would suggest you consider it. Please see:

https://docs.coronalabs.com/guide/system/composer/index.html

Rob

I thought composer was a rather bit much, but you can resolve this topic as I found a solution. Just set y = 0 and it would reset my “pages”. Thanks anyway!