I am trying to display several images tiled together (side-by-side) and allow scrolling of this content by touch. Since it’s a large image I divided it into 20 tiles of 1024x1024 (which is max size for iPhone3GS)… I have files named BG-01.jpg, BG-02.jpg, etc…
The scene works perfectly on the simulator, but when I build it and load it to a (provisioned) device I get either a black screen if I jump right to this scene or get stuck on the previous menu scene if I try to ‘gotoScene’ to this scene… I am bu**ing my balls on it - everything is perfect, and works perfect on all the simulators, why wouldn’t it work the same on the device??? (iPhone4 5.0.1, tried also 4S 5.1)
what’s wrong???
source:
[code]
local storyboard = require( “storyboard” )
local scene = storyboard.newScene()
local screenH = display.contentHeight
local screenW = display.contentWidth
local ratioX, ratioY = 1,1
local bkgSliceW = 1024
local bkgSliceH = 1024
local bkgW, bkgH = 4500,3125
function scene:createScene( event )
local group = self.view
backgroundGrp = display.newGroup()
– load all background slices
for i=1,5 do – columns (x) – 1,5
for j=0,3 do --rows (y) – 0,3
m = (j*5)+i;
fileStr = string.format(’%02d’,m)
bkg1 = display.newImage(“graphics/BGs/slices/BG-”…fileStr…".jpg", true)
backgroundGrp:insert(bkg1)
bkg1:setReferencePoint( display.TopLeftReferencePoint )
bkg1.x = bkgSliceW*(i-1)
bkg1.y = bkgSliceH*j
end
end
backgroundGrp:setReferencePoint( display.CenterReferencePoint )
backgroundGrp.x = screenW/2
backgroundGrp.y = screenH/2
group:insert(backgroundGrp)
end
– Called immediately after scene has moved onscreen:
function scene:enterScene( event )
local group = self.view
backgroundGrp:addEventListener( “touch”, touchSlideListener )
end
<…>
local function touchSlideListener (event)
local phase = event.phase
local t = event.target
if (phase == “began”) then
display.getCurrentStage():setFocus( t )
t.isFocus = true
t.x0 = event.x - t.x
t.y0 = event.y - t.y
elseif t.isFocus then
if phase == “moved” then
– Store initial position
t.x = event.x - t.x0
t.y = event.y - t.y0
– print(“moved”)
elseif phase == “ended” then
display.getCurrentStage():setFocus( nil )
t.isFocus = false
end
end
end
[/code]
------
also tried without the touch listener - same results
tried fiddling with pngs/jpgs - all work well on simulator but not on device
tried working with newImageRect as well - no go
tried even to display only 2/4 photos instead of 20 - no go
please help!
urgent
thanks
[import]uid: 124146 topic_id: 24537 reply_id: 324537[/import] </…>
