Listing Variables and Their Types

OK Sure I’ll get some grief for this… but… :slight_smile:

Is there anyway for AS3 to list all the variables used and their types (and possibly current values) at runtime? like in a trace?

You’ve got flash.utils.describeType
http://livedocs.adobe.com/flex/3/langref/flash/utils/package.html#describeType()

And sampler classes (debugger player only)
http://livedocs.adobe.com/flex/3/langref/flash/sampler/package-detail.html

So if I KNOW the variable name, I can use the describeType, but will only be able to list the variables in swf file the debugger player (not if I create an exe and want to view all the variables and they’re values)?

describeType gives you the variables as defined by an object’s native definition without knowing the name. It’s purpose is to give you the names (and types, and even more info). It cannot, however, provide you with dynamic variables. But dynamic variables you can loop over using a for…in loop.

describeType works in all versions of the player. Only the sampler classes work for just the debugger.