Eduardo Cobuci
Eduardo Cobuci

Reputation: 5640

How to list all methods of an object in ActionScript 3?

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

Answers (3)

Eddie
Eddie

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

Juan Pablo Califano
Juan Pablo Califano

Reputation: 12333

Check out the describeType function.

Upvotes: 8

Alex Nino
Alex Nino

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

Related Questions