I need to disable an onClick action until an animation has stopped. Animations can be started by 4 different buttons - all need to be deactivated.
I use a listener to pass params to the function that will initiate the animation which is why I use an anonymous function in the add listener:
up.addEventListener(MouseEvent.CLICK,
function(event:MouseEvent):void
{
revealSpinner(event,51.42,1,spinner);
event.currentTarget.removeEventListener(event.type, arguments.callee);
},
false, 0, true);
I also have a self calling remove listener, but really I need to remove the listener from the other 3 buttons.
I have also tried naming the anonymous function but that didn't work:
up.addEventListener(MouseEvent.CLICK,
myFunc = function(event:MouseEvent):void
{
revealSpinner(event,51.42,1,spinner);
},
false, 0, true);
// somewhere else in my app
up.removeEventListener(MouseEvent.CLICK, myFunc );
Edit: each of the 4 buttons has to pass different parameters to the revealSpinner() method revealSpinner(event,51.42,1,spinner); revealSpinner(event,51.42,-1,spinner); revealSpinner(event,120,1,anotherMC); revealSpinner(event,120,-1,anotherMC);