# Override class method with dynamic function

**URL:** <https://forum.kirupa.com/t/override-class-method-with-dynamic-function/297743>\
**Category:** flash\
**Created:** [October 7, 2009, 9:26pm UTC](https://forum.kirupa.com/t/override-class-method-with-dynamic-function/297743 "2009-10-07T21:26:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xgraves](https://avatars.discourse-cdn.com/v4/letter/x/7cd45c/32.png) [@xgraves](https://forum.kirupa.com/u/xgraves)\
**Post date:** [October 7, 2009, 9:26pm UTC](https://forum.kirupa.com/t/override-class-method-with-dynamic-function/297743/1 "2009-10-07T21:26:34Z")

</div>

Does anyone know if it’s possible to override a custom class method with a function expression? For instance, if I want to change the destination of a button on the fly, I could theoretically type:

```auto
 var new_destination:Function = function(evt:Event):void{ go_to_new_place();};
myButtonClass.mouse_clicked = new_destination;

```

but unfortunately that generates an error because the class method “mouse\_clicked” is already defined in my class (with the eventListener tied to it). I tried using the “override” keyword in the Function Expression but that didn’t work either. Grrr.
