Start multiple transition.to within loop - Help!

Hi guys,

What I want to achive: I am having an object with several of pieces. I want to loop through a couple of these objects and start a transition.to for each object. I have the following code but I can’t manage to get it to work, it either mess up the data or just moving one piece.

for row in db:nrows(sqlStr) do  
 --Build up params from the database by character |  
  
 local s = row.expression  
 --print(s)  
 local value = string.find (s, '|',1,false );  
  
  
 local startString = (s:sub(0,value-1))  
 local endString = (s:sub(value+1,string.len(s)))  
  
  
 --Build the start params  
  
 startParams[startNo] = {}  
 for w in string.gmatch(startString, "%S+") do  
 --Splitta varje entry vid = och skapa nya   
 local value = string.find (w, '=',1,false );  
 local startString = (w:sub(0,value-1))  
 local endString = (w:sub(value+1,string.len(w)))  
 startParams[startNo][startString] = tonumber(endString)  
 end  
 --Just a check for a special scale instruction  
 if(row.xRef~=0 or row.yRef~=0) then  
 startParams[startNo]["xReference"] = row.xRef  
 startParams[startNo]["yReference"] = row.yRef  
 end  
 startNo = startNo +1;  
 --Build up end params  
 endParams[endNo] = {}  
 for w in string.gmatch(endString, "%S+") do  
 --Splitta varje entry vid = och skapa nya   
 local value = string.find (w, '=',1,false );  
 local startString = (w:sub(0,value-1))  
 local endString = (w:sub(value+1,string.len(w)))  
 endParams[endNo][startString] = tonumber(endString)  
 end  
  
 endNo = endNo + 1;  
  
 --This is the function that starts the transition.to  
 local function startAnim( child, no)  
 --print(child.x, child.y)  
 local reset = function()  
 transition.to(child, endParams[no])  
 isRunning = false  
 end   
 startParams[no]["onComplete"] = reset  
  
 transition.to(child, startParams[no])  
 print(child.name)  
  
 end  
  
 --And the transition.to is triggered within this loop that checks for the object to apply the transition.  
 for k=1,refGroup.numChildren do  
 local child = refGroup[k]  
 if (child.name == "group" .. row.layer) then  
 for l = 1, child.numChildren do  
 local semiChild = child[l]  
 if semiChild.name == row.image .. "\_" .. row.tag then  
 startAnim(semiChild, endNo-1);  
 break   
 end   
 end  
 end  
 end  
 end  
  

Theres a lot of code but I have marked the critical areas within this loop from the db… [import]uid: 81188 topic_id: 23296 reply_id: 323296[/import]