Dohh...Params for transition.to doesn't work?

Hi,

I am trying to build some transitions dynamically but it won’t run the onComplete event?

  
local params = {}  
params["y"]=8  
params["time"]=500  
params["onComplete"] = reverse  
  
 local reverse = function()  
 transition.to(group2,{y=0,time=500})  
 end  
  
transition.to(group2, params)  
  

Any suggestions?

Joakim [import]uid: 81188 topic_id: 22643 reply_id: 322643[/import]

Dohh, the function was outside the scope!

Sorry for that! [import]uid: 81188 topic_id: 22643 reply_id: 90276[/import]

You have a scope problem.

On line 4 above, reverse is either something previously declared or a global.

On line 6, you scope it local to that point in the code going forward, basically over writting the previous reverse. This isn’t the came as changing the value of reverse.

Think of it as the storage bin analogy. You have one bin named “reverse” then later on, you come along and name another bin “reverse”. The system uses the last one you defined while you’re in that particular code block or in lua terms “chunk”.

try moving the whole local reverse = function above the param’s definition and see if that fixes it. [import]uid: 19626 topic_id: 22643 reply_id: 90278[/import]