My solution to display images greater than screen size and “span” on them by finger touch is this:
–
–The image original size has to be multiple of 320 (width) and 480 (height).
–Example: original image 640x960. Create 4 images 320x480 with X,Y origin 1,1; 321,1; 1,481; 321,481.
–Their filenames are f1.jpg, f2.jpg, f3.jpg and f4.jpg. Of course you can name them as you prefer.
–If your original image is greater than 640x960 you have to change some parameters.
–By simulator you have to do double-click to begin touch event.
f1=display.newImage(“f1.jpg”)
f2=display.newImage(“f2.jpg”)
f2.x=320+160
f2.y=f1.y
f3=display.newImage(“f3.jpg”)
f3.x=f1.x
f3.y=480+240
f4=display.newImage(“f4.jpg”)
f4.x=f2.x
f4.y=f3.y
map=display.newGroup()
map:insert(f1)
map:insert(f2)
map:insert(f3)
map:insert(f4)
xx=-160
yy=-240
xxori=xx
yyori=yy
–Display the whole image centered respect on the screen
map.x=xx
map.y=yy
minX=-320
minY=-480
maxX=0
maxY=0
display.setStatusBar(display.HiddenStatusBar)
function map:touch(event)
local phase = event.phase
if “began” == phase then
display.getCurrentStage():setFocus( self )
self.isFocus = true
xxb=event.x
yyb=event.y
elseif self.isFocus then
local x,y = event.x,event.y
if “moved” == phase then
xx=xxori-(xxb-x)
yy=yyori-(yyb-y)
if xx < minX then
xx=minX
end
if xx > maxX then
xx=maxX
end
if yy < minY then
yy=minY
end
if yy > maxY then
yy=maxY
end
map.x=xx
map.y=yy
end
if “ended” == phase then
xxori=xx
yyori=yy
end
end
return true
end
map:addEventListener( “touch”, map )
bye
Piero [import]uid: 2735 topic_id: 317 reply_id: 520[/import]