Change background image during game play?

What I would like to be able to do is change the background image 10 seconds into gameplay. (I have a feeling this isn’t possible though).

Below is what I thought I would try (since I’m messing with the timer anyway), but to no avail.

Ideally I would also like to do this with a transition.to so that the new background actually slides up or gives the feel that the game is sliding down into the new background (should I be using sprites for this?).
Thanks in advance!
M

[code]
local t = display.newText( “0”, 15, 250, “ArialRoundedMTBold”, 50 )
t:setTextColor( 0, 0, 0 )

function t:timer( event )
local count = event.count

print( “Table listener called " … count … " time(s)” )
self.text = count

if count = 10 then
local sky2 = display.newImage( “bkg2.png” )
sky.x = display.contentWidth / 2
sky.y = 195
end
end

timer.performWithDelay( 500, t, 50 )
[import]uid: 42777 topic_id: 7610 reply_id: 307610[/import]

that should be
[lua]if(count==10)[/lua]

if you say [lua]if(count=10)[/lua] then basically it runs the following logic

[lua]count=10
if(count==10) – always true, you just set it![/lua] [import]uid: 6645 topic_id: 7610 reply_id: 27007[/import]

Ah yes, stupid mistake!

However, still didn’t work? Any other ideas? [import]uid: 42777 topic_id: 7610 reply_id: 27055[/import]

here you go brotha!!
Something to get you started!

[code]
local t = display.newText( “0”, 15, 250, “ArialRoundedMTBold”, 50 )
t:setTextColor( 0, 0, 0 )

local sky = display.newImage( “bkg.png” )
sky.x = display.contentWidth / 2
sky.y = 195

local sky2 = display.newImage( “bkg2.png” )
sky2.x = display.contentWidth / 2
sky2.y = 700

function t:timer( event )
local count = event.count

print( “Table listener called " … count … " time(s)” )
self.text = count

if count == 10 then
print(“Change background”)
transition.to(sky, {time = 1000,y=-195})
transition.to(sky2, {time = 1000,y=195})
end
end

timer.performWithDelay( 500, t, 50 ) [import]uid: 10657 topic_id: 7610 reply_id: 27080[/import]

Is there a reason you don’t set the delay to 10000ms, and instead tell it to run 50 times with a 500ms delay? If this is because you want to be able to pause the delay, I would take an entirely different approach. Instead, I would put everything in an enterFrame listener and check getTimer [import]uid: 12108 topic_id: 7610 reply_id: 27075[/import]

rickwhy, you’re the man! Thanks [import]uid: 42777 topic_id: 7610 reply_id: 27224[/import]