flex - inf actionscript 3 (as3), how to pass parameter in anonymous function? -
In As3, I am adding the Event Listener and then adding the anonymous function:
myBox
AddEventListener (MouseEvent.ROLL_OVER, function (e: MouseEvent): zero {warning. Show (count, 'alert box'););
Now this whole piece of code has gone missing n times Now, I have my box and whenever I roll my mouse on the box, it should alert the name. But, what I see is that the last value of the count is used by each box.
How do I pass parameters or values in an anonymous function? (As on the roll, I believe, only one variable is expected)
Opportunity is created to execute the function:
for (var i: int = 0; i & lt; 10; i ++) {(function (count: int): zero {myBox .addEventListener (MouseEvent.ROLL_OVER, function (E: MouseEvent): Zero {warning. Show (calculation, 'alert box');});}) (i); }