I'd hate to change the visibility in the source, someday our js2doc
will want to take full advantage of it, and it's just the right thing
to do.
One alternative is to have the script compiler strip private, and add
public,
for all vars when compiling in debug mode. That would be at a risk of
getting
a different behavior (seems unlikely, would require some bad coding
in the LFC).
Maybe there's some way to leverage namespaces to solve this?
On Feb 11, 2008, at 2:50 AM, Henry Minsky wrote:
I found out the describeType() function has this restriction:
Note: describeType() only shows public properties and methods, and
will not show properties and methods that are private, package
internal or in custom namespaces.
So if we want our debugger to really work nicely, I guess we have to
declare all variables as public on the LFC obejcts...
---------- Forwarded message ----------
From: Henry Minsky <[EMAIL PROTECTED]>
Date: Tue, Nov 15, 2005 at 2:16 PM
Subject: interesting introspection API for AS3
To: Platform Team <[EMAIL PROTECTED]>
So they have an API for inspecting a sealed class. Haven't seen if
there is any API for modifying it at runtime though (I am guessing
not)
Using the introspection API
If you want to list all the public properties and methods of a
non-dynamic (or sealed) class or class instance, use the
describeType() method and parse the results using the E4X API. The
describeType() method is in the flash.util package. The method's only
parameter is the object that you want to introspect. You can pass it
any ActionScript value, including all available ActionScript types
such as object instances, primitive types such as uint, and class
objects. The return value of the describeType() method is an E4X XML
object containing an XML description of the object's type.
The following example instrospects the Button control and prints the
details to TextArea controls:
<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2005/mxml"
creationComplete="getDetails()">
<mx:Script>
<![CDATA[
import flash.util.*;
public function getDetails():Void {
// Get the Button control's E4X XML object description:
var classInfo:XML = describeType(button1);
// Dump the entire E4X XML object into ta2:
ta2.text = classInfo.toString();
// List the class name:
ta1.text = "Class " + [EMAIL PROTECTED]() + "\n";
// List the object's variables, their values, and their types:
for each (var v:XML in classInfo..variable) {
ta1.text += "Variable " + [EMAIL PROTECTED] + "=" + [EMAIL PROTECTED] +
" (" + [EMAIL PROTECTED] + ")\n";
}
// List accessors as properties:
for each (var a:XML in classInfo..accessor) {
ta1.text += "Property " + [EMAIL PROTECTED] + "=" + [EMAIL PROTECTED] +
" (" + [EMAIL PROTECTED] +")\n";
}
// List the object's methods:
for each (var m:XML in classInfo..method) {
ta1.text += "Method " + [EMAIL PROTECTED] + "():" + [EMAIL PROTECTED] + "\n";
}
}
]]>
</mx:Script>
<mx:Button label="Submit" id="button1"/>
<mx:TextArea id="ta1" width="400" height="200" />
<mx:TextArea id="ta2" width="400" height="200" />
--
Henry Minsky
Software Architect
[EMAIL PROTECTED]
--
Henry Minsky
Software Architect
[EMAIL PROTECTED]
--
Don Anderson
Java/C/C++, Berkeley DB, systems consultant
voice: 617-547-7881
email: [EMAIL PROTECTED]
www: http://www.ddanderson.com