Skip to content

Instantly share code, notes, and snippets.

@seaders
Created March 11, 2015 11:00
Show Gist options
  • Select an option

  • Save seaders/c246d4c01898cf3f94de to your computer and use it in GitHub Desktop.

Select an option

Save seaders/c246d4c01898cf3f94de to your computer and use it in GitHub Desktop.
package
{
public class FunctionyTest
{
public function FunctionyTest()
{
functionAccepter(noArgs);
// output: noArgs function called
functionAccepter(someArgs, "asdf", 1234);
// output: someArgs function called with asdf 1234
}
private function noArgs():void
{
trace("noArgs function called");
}
private function someArgs(s:String, n:int):void
{
trace("someArgs function called with " + s + " " + n);
}
private function functionAccepter(f:Function, ...args):void
{
f.apply(this, args);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment