Reputation: 5640
How do I get the list of all methods from an object? I know I can get the object class in this way:
var className:String = flash.utils.getQualifiedClassName( myObject );
var objClass:Class = flash.utils.getDefinitionByName( className ) as Class;
It gives me an the class prototype, but and can't do anything with it...
In JavaScript I can iterate over the prototype of an object to get its properties and methods.
Is that possible in ActionScript 3? Do you any good source for metaprogramming/reflection over ActionScript 3?
Thanks!
Upvotes: 3
Views: 2845
Reputation: 1536
Assuming you're using FP 11+, this is an easier way to list all functions of a class in AS3.
var req = new URLRequest('');
trace(JSON.stringify(req))
It also works for data objects.
Upvotes: 0
Reputation: 31
Have you tried using the operators (for ... in...) once you got the Class reference or the Object instance? It should work.
Upvotes: 1