Hi,
How can I assign a eventListener to a variable?
Do I just do
myListener = obj:addEventListener("event", listener)
?
EDIT:
Hey, sorry, wasn’t very descriptive.
I’m listening for a touch, so
myVariable = obj:addEventListener("touch", myListener)
I want to assign the eventListener to a variable because I want to
myVariable = obj:removeEventListener("touch", myListener)
remove the event listener - I was trying to remove an event listener to the object but it said I supplied a “nil key for property lookup”. So,if I assigned it to a variable, would the simulator know what I was talking about? I had 4 event listeners on the “obj”, so I don’t think the simulator knew which one - and it was in a different function, was that part of it?
Thanks as always,
cozymonster