CreationComplete only fires once so that handler probably isn’t getting removed
either.
When you type: change=”mytext_changeHandler(event)”
The compiler generates code like this:
private function
mytext_changeHandler_10423948(event:TextOperationEvent):void
{
mytext_changeHandler(event);
}
What is in the attribute is really the body of that generated code and it is
not the handler itself.
On 1/19/10 5:34 PM, "j2me_soul" <[email protected]> wrote:
Can't remove the eventhandler which wrote in mxml.
protected function mytext_changeHandler(event:TextOperationEvent):void
{
TextInput(event.target).removeEventListener(event.type,
mytext_changeHandler);
}
<s:TextInput id="mytext" text="textevent" change="mytext_changeHandler(event) />
The handler function which defined in the application creationComplete handler
can be removed. I confused ~
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
mytext.addEventListener(TextOperationEvent.CHANGE, mytext_changeHandler);
}
protected function mytext_changeHandler(event:TextOperationEvent):void
{
TextInput(event.target).removeEventListener(event.type,
mytext_changeHandler);
}
<s:TextInput id="mytext" text="textevent"/>
--
Alex Harui
Flex SDK Team
Adobe System, Inc.
http://blogs.adobe.com/aharui