```
class Foo {
   public function bar():void { ... }
}

var clazz:Class = Foo;

// ...enter the function (no Foo literal here)
var fun:Function = clazz["bar"]; // PROBLEM: returns null

// later
fun.call(new Foo(), ...);

```

What is the correct way to do the above? The Java equivalent of what I want to do is:

```
Method m = Foo.class.getMethod("bar", ...);
m.invoke(new Foo(), ...);

```

---

Actual code (with workaround):

```
class SerClass {

    public var className:String;
    public var name:String;
    private var ser:String = null;
    private var unser:Function = null;

    public function SerClass(clazz:Class):void {

        var type:XML = describeType(clazz);

        className = type.@name;

        // determine name
        name = type.factory.metadata.(@name=="CompactType").arg.(@key=="name").@value;

        // find unserializer
        var mdesc:XML = XML(type.method.metadata.(@name=="Unserialize")).parent();
        if (mdesc is XML) {
            unser = clazz[mdesc.@name];
        }

        // find serializer
        var sdesc:XML = XML(type.factory.method.metadata.(@name=="Serialize")).parent();
        if (sdesc is XML) {
            ser = sdesc.@name;
        }

    }
    public function serialize(obj:Object, ous:ByteArray):void {
        if (ser == null) throw new Error(name + " is not serializable");
        obj[ser](ous);
    }
    public function unserialize(ins:ByteArray):Object {
        if (unser == null) throw new Error(name + " is not unserializable");
        return unser.call(null, ins);
    }
}

```