returning a number in a sequence

Perhaps my subject header doesn’t do my question justice, so let me explain a littler more.

I want to be able to activate an event listener for objects named in a numerical series.

Say there are five objects named 1 through 5. Is there any way to get the event listener to activate with each object without having to make a separate listener for each one? Perhaps something similar to math.random(1,5), though that activates the event listener only on repeated attempts (when the correct number is randomly generated)?

Let me know if my question is totally unclear, I am reaching for the semantics and feel that I am coming up empty. [import]uid: 102017 topic_id: 17381 reply_id: 317381[/import]

if you have,say, obj1,obj2,obj3 you can attach listeners to them like that:

[lua]for i=1,3 do
obj…i:addEventListener(…)
end[/lua]

or is it not what you need? [import]uid: 16142 topic_id: 17381 reply_id: 65809[/import]

Thank you, again!

This completely addresses my needs, and makes clear why I was having trouble finding the right words.

[import]uid: 102017 topic_id: 17381 reply_id: 65811[/import]