On Sat, Apr 5, 2008 at 8:58 PM, Omar Fouad <[EMAIL PROTECTED]> wrote: > Hi, > I've got a function that is called when a listener listens an event like: > > fancyButton.addEventListener(MouseEvent.CLICK, myFunction); > > private function myFunction(e:MouseEvent):void { > // statements... > } > > If I try to call myFunction using myFunction() , the compiler throws me an > error, saying that the function expects an argument. At this point how > should I call this function without dispatching the MouseEvent Event?? >
You might want to separate the functions, so you would have myFunction(), which you could call from anywhere, and myClickHandler, which would handle the mouse event specifically. So: fancyButton.addEventListener(MouseEvent.CLICK, myClickHandler); private function myClickHandler(e:MouseEvent):void { myFunction(); } private function myFunction():void{ //blah blah... } _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders