Hi,
I am struggling with this. I have an EventListener function that receives a parameter. For any reason, seems that Flash doesn’t like it when it is time to REMOVE it:
var counter:Number = 0;
btnCreate.addEventListener(MouseEvent.CLICK,Create);
btnRemove.addEventListener(MouseEvent.CLICK,Remove);
function Create(e:MouseEvent):void
{
addEventListener(Event.ENTER_FRAME,MyEvent(""));
}
function Remove(e:MouseEvent):void
{
// the following line of code doesn't remove the Event!
removeEventListener(Event.ENTER_FRAME,MyEvent(""));
}
function MyEvent(myparameter:String):Function
{
return function (e:Event):void
{
counter++;
trace (counter);
}
}
What is the trick to remove an EventListener when its triggered function does have a parameter?
Thanks!