Skip to content

Instantly share code, notes, and snippets.

@robertpenner
Created October 27, 2011 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertpenner/1319052 to your computer and use it in GitHub Desktop.
Save robertpenner/1319052 to your computer and use it in GitHub Desktop.
trying to get function signature
protected function listenerValid(listener:Function):Boolean
{
var scope:Array = getLexicalScopes(listener);
var scopeXML:XML = flash.utils.describeType(scope[0]);
// No clue on how to get the "name" of the function passed. I had to use a hard coded string of "hearSignal" for this test
var functionDescriptionXML:XML = scopeXML.factory.method.(@name == "hearSignal")[0];
var params:XMLList = functionDescriptionXML..parameter;
}
@karfau
Copy link

karfau commented Oct 29, 2011

if the Function-instance is from a public property or mehtod af an instance you have access to, I think you could iterate over the list of methods/properties and test if
listener == instance[method.@name](This could maybe work without reflection, if the method is a public and enumerable property of the class.)
I don't think the is another option other then using bytecode-based reflection...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment