class AddClass extends MovieClip {
private var Func_without_param:Function;
private var Func_with_param:Function;
private function onRollOver():Void {
//trace("Rolled");
}
private function onPress():Void {
//call a function without parameter
//Example: Func_without_param();
}
private function onRelease():Void {
//call another function with parameter, it can be Func_with_param(paramA) or Func_with_param(paramA, paramB)
}
private function onReleaseOutside():Void {
//same as onRelease
}
public function InputFunction(param_func:Function) {
this.Func_without_param = param_func;
}
}
In fla, I use drag and drop a movieclip to the stage (linkage -> AS 2.0 class :AddClass). I don’t want to use attachMovie due to some reasons.
Then, I use
myBtn.InputFunction(A_FUNCTION);
There are bunch of functions with or with parameters in the fla.
I don’t think the structure above is good. What’s the good way to add another function with parameters when I call? Because my function can be FUNCTION(paramA) or FUNCTION(paramA, paramB,…)
Any suggestion or advice?
Thanks in advance!