Like in JavaScript, Action Script have the callback feature. You guys are always using that in addEventListener/removeEventListener, out of that you can be able to implement that for your own functions. apply() and call() are the methods to invoke ‘Function’ objects. Basically both are same, but the only difference is that, apply() is using when the parameters to the callback function are unknown, but call() is using when the parameters to the functions are know.
If you have a function like callMe(), and wanna callback, just use callMe.call(); from any where in your class, if you want to call from another class just pass the name to that class’s member function and just call from there with that name. If you don’t understand this just look into my demonstration or download the source file.
Here is my simple demonstration of callback.
ClassOne and Message are the classes used. ClassOne have two member functions called ClassOneMemberFunction and ClassOneMemberFunctionWithParams. Message class have one member function called showMessage, which accept one string param and other two optional parameters for callback, _callBack and _callBackPrams.
ClassOne.as
public class ClassOne {
public function ClassOne ():void {
var msg = new Message;
msg.showMessage ("This message from ClassOne", ClassOneMemberFunction);
}
private function ClassOneMemberFunction ():void {
trace ("ClassOneMemberFunction is a private function on ClassOne(Called by callback method)");
}
private function ClassOneMemberFunctionWithParams (prams:*):void {
trace ("::::: Prams are " + prams.value1 );
}
}
msg.showMessage (“This message from ClassOne”, ClassOneMemberFunction); in this line the ClassOneMemberFunction is the callback function name you can see a function in the class. It will be called from Message Class.
Message.as
public class Message {
public function Message ():void {
}
public function showMessage(msg:String, _callBack:Object = null, _callBackPrams:* = null){
trace("ShowMessage: " + msg);
if(_callBack != null && _callBackPrams != null ) {
_callBack.call(null, _callBackPrams);
}else if(_callBack != null){
_callBack.call();
}
}
}
In our example _callBack.call() means ClassOneMemberFunction.call(). Hope you understood the callback feature. You will get a clear picture while executing the example source code.

Thank you for this!
I’ve need trying to do this for some time without success.