Extend flash.utils.Proxy
and use the flash.utils.flash_proxy
namespace. There's methods similar to __get
, __set
and methods for delete methods as well. For example, the __call
method is:
override flash_proxy function callProperty(name:*, ...rest):*;
so if have a class that extends Proxy, you do:
var test:MyObject = new MyObject();
test.myMethodThatIsntDefined("param");
then callProperty will be called and name will be set to "myMethodThatIsntDefined" and "param" will be in the ...rest array.
The link to the asdoc has a simple implementation that should get you going. I typically use the Proxy class for something like an API. For example, back in the day I had a Flickr API wrapper that translated the name of the function call to an API method name in the Flickr API. Something like:
flickr.galleriesGetPhotos();
and in the callProperty I'd split on the first word to get the API name "flickr.galleries.get_photos". The names were different back then I think.