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.


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.


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

Int value in MousePressed in one JPanel not updating when the Int changes

java swing menubar actionevent mousepress

I'm coding an application to print bricks in the grids, and I have set it up so that ideally, to change the colour, the menu selection changes an int which sets the colour in the bricks class.

Cocos2d-x CCArray - Objects and Sprites

c++ cocos2d-x

I am new in c++ and cocos2d-x, and I have a problem.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.