fade an image in then out?

Can anyone take a look at this and help me please.

http://pastebin.com/TFpXrBE0 [import]uid: 68741 topic_id: 14683 reply_id: 314683[/import]

You seem to be missing your alpha=0 or alpha=1 from your transition.to/from? [import]uid: 23693 topic_id: 14683 reply_id: 54301[/import]

Thanks, but it still doesn’t work?

[code]
local function flashWhite ()

flash.isVisible = true
transition.to( flash, { time=200, alpha = 1, onComplete=listener1 } )

local listener1 = function( obj )

transition.from( flash, { time=200, alpha = 0, onComplete=listener2 } )

end

local listener2 = function( obj )

flash:removeSelf()

end

end

flashWhite()
[/code] [import]uid: 68741 topic_id: 14683 reply_id: 54302[/import]

Weird, not sure. Try this, I tested locally and this works:

[lua]local img = display.newImage(“flash.png”)

function img:fade()
self.alpha = 0
self.tween = transition.to(self, {time=500, alpha=1, onComplete=img.onFadeIn})
end

function img:onFadeIn()
transition.cancel(self.tween)
self.tween = transition.to(self, {time=500, alpha=0, onComplete=img.onFadeOut})
end

function img:onFadeOut()
transition.cancel(self.tween)
self:removeSelf()
end

img:fade()[/lua] [import]uid: 23693 topic_id: 14683 reply_id: 54315[/import]