In as3, I am adding event listener and then attaching the anonymous function to it:
myBox.addEventListener(MouseEvent.ROLL_OVER,
function(e:MouseEvent):void
{
Alert.show(count, ‘Alert Box’);
);
Now this whole piece of code is looped n times. Now, I have n myBoxes and whenever I roll my mouse over the box, it should alert the name. But, what I see is that the last value of count is used by each box.
How can I pass parameter or value to the anonymous function? ( as roll over , I believe, expects only one variable)
You need to create a new scope by executing a function: