transition onComplete seems to fire too soon

I seem to be having an issue with the transition onComplete functionality. Using the debugger it seems that the onComplete function is fired a soon as the transition starts? I get the print statement immediately when the code runs and not after the transition.

[lua]local function splashComplete()
Runtime:addEventListener(“enterFrame”, gameEnterFrameHandler)
callUnload = true
print(“splashComplete”)
end
function init( )
Runtime:removeEventListener(“enterFrame”, gameEnterFrameHandler)
transition.to(logo, {time=5000, alpha=1, onComplete=splashComplete()})
–transition.to(logo, {delay=2, time=250, alpha=0,onComplete = splashComplete()})
end[/lua] [import]uid: 6636 topic_id: 3192 reply_id: 303192[/import]

remove the parentesis

[lua]transition.to(logo, { time=5000, alpha=1, onComplete=splashComplete })[/lua]
[import]uid: 5712 topic_id: 3192 reply_id: 9386[/import]

Perfect! thanks so much. Figured I was doing something wrong :slight_smile: [import]uid: 6636 topic_id: 3192 reply_id: 9388[/import]

If you add the parenthesis when referencing a function then the function actually fires.

So if you attach a function to a table like

local function myFunction ()  
  
end  
  
local myObject = dislay...  
  
myObject.myfunction = myFunction  

This attaches the function to the object

myObject.myfunction = myFunction()  

This would assign the result of myFunction() to myObject.myfunction [import]uid: 5354 topic_id: 3192 reply_id: 9662[/import]