The following demonstrates it working for me
//background infinite scrolling - good for jetpack joyride style of gameplay
//made for iphone resolution - change for your own prefered
SetVirtualResolution(960,640)
//background array
global dim BG[10]
//set background sprite
for num = 1 to 9
BG[num] = CreateSprite (0)
SetSpriteSize(BG[num],64,64)
//SetSpriteColor(BG[num],random(1,255),random(2,255),random(1,255),255)
col=MakeColor(random(1,255),random(1,255),random(1,255))
SetSpriteImage(BG[num],CreateImage(col))
SetSpritePosition(BG[num],random(0,960),random(0,640))
next num
//main loop
AddVirtualButton(1,100,100,100)
Do
if GetRawKeyState(37)
x=x+1
endif
if GetRawKeyState(39)
x=x-1
endif
if GetVirtualButtonState(1)
DeleteAllSprites()
DeleteAllImages()
for num = 1 to 9
BG[num] = CreateSprite (0)
SetSpriteSize(BG[num],64,64)
//SetSpriteColor(BG[num],random(1,255),random(2,255),random(1,255),255)
col=MakeColor(random(1,255),random(1,255),random(1,255))
SetSpriteImage(BG[num],CreateImage(col))
SetSpritePosition(BG[num],random(0,960),random(0,640))
next num
endif
//offsetting
SetViewOffset (x, 0)
sync()
Loop
function CreateImage(color)
SetClearColor(0,0,0)
ClearScreen()
//draw craft
DrawBox(0,0,16,16,color,color,color,color,1)
img = getImage(0,0,16,16)
SetImageTransparentColor(img,0,0,0)
endfunction img