The title of this post says it all…
Is it possible to pass parameters to an event completion routine? [import]uid: 295 topic_id: 1720 reply_id: 301720[/import]
The title of this post says it all…
Is it possible to pass parameters to an event completion routine? [import]uid: 295 topic_id: 1720 reply_id: 301720[/import]
No, but maybe you can store this parameters right into the object itself. [import]uid: 5712 topic_id: 1720 reply_id: 5053[/import]
yes you can do this
just create a parameter on the timer
[lua]local function fadeOut(event)
print(event.source.something) – “hi”
end
local t2 = timer.performWithDelay ( 1000, fadeOut, 1 )
t2.something = “hi”[/lua]
for transition.to the callback “event” is actually the target object, so as mentioned above put the parameters on the object
eg
[lua]local ball=display.newImage(“ball.png”)
local function fadeOut(obj)
print(obj.something) – “whatever”
obj:removeSelf()
end
ball.something=“whatever”
transition.to(ball, {time=1000, alpha=0, onComplete=fadeOut}) [/lua] [import]uid: 6645 topic_id: 1720 reply_id: 11546[/import]
nevermind. [import]uid: 5613 topic_id: 1720 reply_id: 20024[/import]