The problem is that I am using rotationfix.lua to change the rotation of the device.I am using landscapeLeft and landscapeRight(Default).Now the problem is that when i am sliding the scene it works in opp. direction can anyone suggest me solution for this problem please?here is what i am trying to do with sliding the screen.
[lua]local fslide = function ( event )
if event.phase == “ended” then
drop = event.x + 10
if event.xStart > drop then
director:changeScene( “Page02”, “moveFromRight” )
end
end
end
bgimage:addEventListener ( “touch” , fslide )[/lua] [import]uid: 82446 topic_id: 18363 reply_id: 318363[/import]
When the screen is rotated, reported coordinates will still stay the same… You should reverse the coordinates for tilt,touch etc for yourself…
If your problem is with the swipe direction try using isRotated variable set by the rotationfix.lua
Code is not tested but something like that should do it…
[lua]local fslide = function ( event )
if event.phase == “ended” then
if isRotated then
drop = event.x - 10
else
drop = event.x + 10
end
if event.xStart > drop then
director:changeScene( “Page02”, “moveFromRight” )
end
end
end
bgimage:addEventListener ( “touch” , fslide )[/lua] [import]uid: 10478 topic_id: 18363 reply_id: 70386[/import]
I guess I posted the code too quick 
You might also need to change “event.xStart > drop” to “event.xStart > drop” if reversed… Anyway, I guess you’ve got the idea… check isRotated var to handle reversed state…I hope this helps… [import]uid: 10478 topic_id: 18363 reply_id: 70388[/import]
Ya i got that…Thanks:) [import]uid: 82446 topic_id: 18363 reply_id: 70561[/import]
hi again.
Now I am facing problem with my game.
[lua]local function drag (event)
jarimg.x = event.x
end
jarimg:addEventListener (“touch”, drag)[/lua]
when I drag my jar to left it moves towards the right and vice versa.And is not functioning properly.Please help me if anybody can… [import]uid: 82446 topic_id: 18363 reply_id: 75775[/import]
You’ll have to keep track of when the device is rotated and adjust the event x and y accordingly.
Something like this:
[lua]local function drag (event)
local newX = event.x;
local newY = event.y;
if (deviceIsRotated) then
newX = display.contentWidth - event.x;
newY = display.contentHeight - event.y;
end
jarimg.x = newX;
end
jarimg:addEventListener (“touch”, drag)[/lua] [import]uid: 70847 topic_id: 18363 reply_id: 75779[/import]
This isn’t helping me out…Same problem persists.Any other way out please… [import]uid: 82446 topic_id: 18363 reply_id: 75783[/import]
If you’re following my sample code, then you need to set the variable
deviceIsRotated = true
in your code where you detect that the device is rotated.
[import]uid: 70847 topic_id: 18363 reply_id: 75790[/import]
thanks for the help …But (isRotated == false) worked for me…
[import]uid: 82446 topic_id: 18363 reply_id: 75795[/import]