android - call transition.to with id: corona SDK -


in 1 of corona apps, i've apply transition objects id. how can this?

local ball = display.newimage("ball.png")     -- sample, there random no. of balls created @ instant. ball.id = "ball_id"  transition.to(ball,{time=200,x=400})    -- here, instead of ball, need call objects(if any) id="ball_id"  

any advice appreciable...

you can store objects in table.
solution work if remove objects balls table.
works because used ipairs.
more info: http://lua-users.org/wiki/tablestutorial

local balls = {}  local function createrandonball( id )     local ball = display.newimage("ball.png")      ball.id = id      balls[#balls + 1] = ball end  local function animateball(id)      i, object in ipairs(balls)         if(object.id == id)             transition.to(object, {time=200,x=400} )         end     end  end   animateball("ball_id")  //call objects(if any) id="ball_id" 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -