Flex 4 - programmatically set the button click handler function

I am looking for a way to programmatically parse a click handler function using a button on my mxml component using actionscript code.

Something like what the earlier ActionScript allows,

mybutton.click = null;

Thanks in advance

+3
source share
2 answers

If you have a function that has been registered as a listener:

mybutton.removeEventListener( 'click', theFunction );

If you don’t ... well, think about code reorganization? You can also add another handler something like this:

mybutton.addEventListener( 'click', function( e:Event ):void {
  e.stopImmediatePropagation();
  return false;
}, false, 1 );

Which can prevent further handlers from starting (1 at the end is a priority ) ... Sometimes it's hard to say with flex.

+5
source

, , click.

"" , , , .

,

0

Source: https://habr.com/ru/post/1726976/


All Articles