Hey Josh,
thanks well I an working on a big project and a lot of
creation complete and other mxml defined events are there
I used a hack to kill the eventlistener
basically just did a
var comp:UIComponent = event.currentTarget as UIComponent;
comp.removeEventListener(MouseEvent.CLICK, Application.application
["__btn_click"];
so there is 2 underscore , the id of the component in this case "btn" and
then underscore again and then the event name , which is click here
and that basically took care of the problem.
cheers
firdosh
On 9/14/07, Josh Tynjala <[EMAIL PROTECTED]> wrote:
>
> As far as I know, it's not possible to remove events of this type. The
> Flex compiler actually generates a function to wrap around whatever you
> call. You can see the exact code if you look at the generated code using the
> -keep compiler argument, but it looks something like this:
>
> private function someGeneratedFunctionName(event:MouseEvent):void
> {
> //your code gets copied here
> onClick();
> }
>
> You can get an idea of why when you think of the fact that the "event"
> parameter is available in your click="" attribute in the MXML. You can
> either pass it to your function or ignore it completely. In ActionScript,
> when you use addEventListener instead, your function must always accept an
> event parameter.
>
>
> Firdosh Tangri wrote:
>
> hey all,
> I was just wondering if i define an event by mxml like
> <mx:Button id="myBtn" click="onClick();") />
>
> and then try and remove it
>
> private function onClick():void{
> trace("Click");
> myBtn.removeEventListener(MouseEvent.CLICK, onClick);
> }
>
> it still keeps calling the function but if i add the event listener
> through as
>
> like
>
> myBtn.addEventListener (MouseEvent.CLICK , onClick);
>
> then it removes the call back function.
>
> thanks
> cheers
> firdosh
>
>
>
>
>
>