hello…
I have a for i loop.
many objects (30)
how can I add an event listener to each of them
if I want each of them do a different action
when you touch them
I have this
function tt( event ) if ( event.phase == "began" ) then if ball[1] == 1 then bg.alpha = .2 else bg.xScale = 3 end end return true end for i = 1, many do ball[i] = display.newSprite( crazyBallImage, sequenceCrazyBall ) sceneGroup:insert(ball[i]) ball[i].x = display.contentCenterX ball[i].y = display.contentCenterY ball[i].xScale = .5 ball[i].yScale = .5 ball[i].setSequence = "bb" ball[i]:play() ball[i]:addEventListener( "touch", tt ) end
is a simple function but I can not make it to work
thanks for your help
victor