Unable to use event.target with ui.lua button functions

Any idea why event.target isn't working for a function that handles a ui.lua button touch event?

Here's my code, which is supposed to flash a button then change scenes:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
function flash(object)
        object.isVisible = not object.isVisible
end
 
 
function startGame( event ) 
 
        if event.phase == 'release' then
        
                local t = event.target
                
                local flashItem = function() return flash(t) end
                timer.performWithDelay(100, flashItem, 10)
                        
                local function changeScene()
                        director:changeScene("mainGame","moveFromRight")
                        timer.cancel(flashItem)
                end
                
                timer.performWithDelay(1000, changeScene, 1)
        end
end
views:1544 update:2011/10/3 8:06:12
corona forums © 2003-2011