No one's likely to answer this on this long weekend at 1 in the morning, but I'll ask anyway.
I'm trying to create a utility function package which uses introspection through describeType to get information about classes. Is there a way to get at properties/functions of an object using the [] operator if those properties are in a custom namespace?
Here's some code:
Main.as
Code:
...
public namespace madeup = "madeUp";
madeup function aMadeUpFunction(i:int, k:String, j:DisplayObject):String
{
return "hi!";
}
DescribeType node of that method:
Code:
<method name="aMadeUpFunction" declaredBy="Main" returnType="String" uri="madeUp">
<parameter index="1" type="int" optional="false"/>
<parameter index="2" type="String" optional="false"/>
<parameter index="3" type="flash.display::DisplayObject" optional="false"/>
</method>
Is there a way to do something like this?
Code:
var f:Function = obj['madeUp::aMadeUpFunction'];
Clearly, that doesn't actually work. I get this:
Code:
Error #1069: Property madeUp::aMadeUpFunction not found on Main and there is no default value.
obj is an instance of Main.
I saw http://troyworks.com/blog/2007/08/05...-of-namespace/ which looks like it's most of the way there, but I need to use an arbitrary namespace, not a predetermined one. I also don't seem to have access to the actual namespace through describeType, only the uri used to define it.
Also, I managed to crash the flex compiler with a NullPointer just now by doing this:
So, don't do that.