Is it possible to listen to a method call in action script 3?

Given an instance of MyClass, I want to be notified when someone calls an specific method.

example:

package bar;
{
  public class MyClass {

      private var foo:int;

      public function MyClass() { foo = 2; }
      public function getFoo():int { return foo; }
  }
}

So given a instance of MyClass ( var instance = new MyClass() ) i want to be notified every time getFoo is called. I have tried using reflection+annotations+dynamic classes, to find that in AS3 you can't change seal methods (methods defined in the class). I was wondering if i can subscript to a event in order to be notified when the method is called.

Answers


There is no event for every method call, and MyClass is not even EventDispatcher. I suppose you cannot alter MyClass definition, otherwise that would be too simple.


Need Your Help

Losing focus and clicking on a close button of my window?

objective-c cocoa nswindow

I've a method triggered when a NSTextField looses focus. This method displays a popup sheet over my current window.

How do I make Flex file upload work on firefox and safari?

flex firefox file upload

I have a flex app that uploads files to a server. The server requires authentication to be able to upload. In IE the upload works fine. However in FF and Safari, it does not upload. I have seen peo...