load new image after previous fades out.

Hi
I am complete newbie to android.
and i have a functionality working where
i fade in and fade out image when app starts but
i am not sure how do i load new image which is a welcome screen
when splash screen fades out.

here is my code which works for fade out.

local background=display.newImage(“image1.png”,true)

local function fadeinfadeoutimage()
transition.to(background,{time=4500,alpha=0})
end

fadeinfadeoutimage() [import]uid: 139853 topic_id: 24472 reply_id: 324472[/import]

you can supply an extra parameter to the transition.to call, which is the name of a function.
The function will execute when the transition completes.
In that function, you can display the new image or switch to a new screen entirely.
[import]uid: 108660 topic_id: 24472 reply_id: 99042[/import]

Here is an example of a way to handle this.

In the beginning load the images. Then cross fade them by fading one out and the other in. Finally dispose of the first screen. It in most cases is no longer needed (thats my guess). Do this by calling a cleanup function by adding “onComplete” to your final transition.

[code]
– Load images and hide welcome screen by setting alpha to 0.

local background=display.newImage(“image1.png”,true)
local welcome=display.newImage(“image2.png”,true)
welcome.alpha = 0

– Create function to remove startup image and clean up the memory used.

local function removeBackground()
background:removeSelf()
background = nil
collectgarbage(“collect”)
end

– Create function to cross fade images and finally
– call the function to start the fading.

local function fadeinfadeoutimage()
transition.to(background,{time=4500,alpha=0})
transition.to(welcome,{time=4500,alpha=1,onComplete=removeBackground})
end

fadeinfadeoutimage()
[/code] [import]uid: 56820 topic_id: 24472 reply_id: 99091[/import]