R – Flash/AS3 passing a method into a method

actionscript-3flashmethods

I am trying to make a transitionmanager and I wish to pass a method into a method, because I would like to make a bunch of different seperate transition methods which I fetch as a public static function from a Transitions class.

Example

in TransitionController class:

public function doTransition(mc:MovieClip, transition:Function = Transitions.Basic):void {
        transition(mc);
    }

in Transitions class:

public class Transitions
{

    public static function Basic(mc:MovieClip = null):void {
        // a whole lot of transitional stuff here
        trace("Transitions.Basic:" + mc);
    }

}

Does this make sense? I cant get around to get it to work

Best Solution

never mind it went wrong somewhere else :) it works forgot to add colons Transition.Basic()

Related Question