Is this correct? if you declare a listener in mxml on a button
you can't remove the click listener from that button in actionscript?
on the other hand if you declare a function to an object in actionscript, you can remove the listener from that object in actionscript???
in AS mybtn.removeEventListener(MouseEvent.CLICK,myfunction);
basically mxml just wraps itself around AS/API calls much the same way it does for properties , so mxml allows you to assign values rather than having to use the full call.
With say obj.resort = functionX() you remove that function by obj.resort=null;
When you write code like
<s:Button id="b1" click="doSomething()"/>
the compiler autogenerates an event handler like
private function _b1_clickHandler(event:MouseEvent):void
and registers it with a call like
You can call removeEventListener(...) to unregister it, but to do so you have to know the name the compiler chose for the autogenerated method. You shouldn't write code like this because the naming algorithm might change in a future version of the compiler.
MORAL: If you want to remove an event handler, write the handler yourself in ActionScript and register it yourself with addEventListener().
Adobe Flex SDK Team