hello mate as i said in my previous post actually i have tried to combine both event listener but it didnt really work. For better understanding i will let you know what I currently have:
[code]local function moveCamera( event )
if event.phase == “began” then
test = camera.y
end
if event.phase == “moved” then
camera.y = test + (event.y - event.yStart)
end
if event.phase == “ended” or event.phase == “cancelled” then
myText.text = camera.y
if camera.y >= 0 then
camera.y = 0
myText.text = 0
elseif camera.y <= -480 then
camera.y = -480
myText.text = -480
end
end
end
Runtime:addEventListener( “touch”, moveCamera )
local function onOrientationChange( event )
if event.type == “landscapeLeft” then
facebookBtn.x = display.contentWidth / 2 + 220
facebookBtn.y = display.contentHeight / 5 - 30
twitterBtn.x = display.contentWidth / 2 + 170
twitterBtn.y = display.contentHeight / 5 - 30
[/code]
previously i tried to change the above codes to be like this:
[code]local function moveCamera( event )
if event.phase == “began” then
test = camera.y
end
if event.phase == “moved” then
camera.y = test + (event.y - event.yStart)
end
if event.phase == “ended” or event.phase == “cancelled” then
myText.text = camera.y
if camera.y >= 0 then
camera.y = 0
myText.text = 0
elseif camera.y <= -480 then
camera.y = -480
myText.text = -480
end
end
end
Runtime:addEventListener( “touch”, moveCamera )
local function onOrientationChange( event )
if event.type == “landscapeLeft” and camera.y >= 0 then
camera.y = 0
myText.text = 0
facebookBtn.x = display.contentWidth / 2 + 220
facebookBtn.y = display.contentHeight / 5 - 30
twitterBtn.x = display.contentWidth / 2 + 170
twitterBtn.y = display.contentHeight / 5 - 30
elseif event.type == “landscapeLeft” and camera.y <= - 800 then
camera.y = -800
myText.text = -800
facebookBtn.x = display.contentWidth / 2 + 220
facebookBtn.y = display.contentHeight / 5 - 30
twitterBtn.x = display.contentWidth / 2 + 170
twitterBtn.y = display.contentHeight / 5 - 30
[/code]
Now as you can see there I added [text]and camera.y[/text] in every onOrientationchange event type but it doesn’t solve the issue. The original code [text] elseif camera.y <= -480[/text] still overwrite the rules inside onOrientationChange events. I cant simply delete the original codes inside moveCamera function as it’ll make the scrolling limitation not working.
Or did I make any mistake in “integrating” the codes there?
*PS: Maybe you are wondering why it’s [text] <= -480 [/text] instead of [text] >= 480[/text] but i see that it’s actually negative number if you scroll to the bottom that’s why I use [text] >= 0 [/text] and [text] <= -480 [/text] (bigger than 0 is if you scroll to the top and less than -480 is if you scroll to the bottom). However, the position of BlaBlaButton.y is at 800 in the most bottom placement (the bigger the number is, the further down the position is). I hope it clears it why i use negative number for the scrolling part [import]uid: 114765 topic_id: 28807 reply_id: 116293[/import]