Flash里回调函数的简单示例
2010-09-09 16:21:23| 分类: as3 | 标签: |字号大中小 订阅
package {
import flash.display.MovieClip;
import DemoClass;
public class Main extends MovieClip {
protected var demo:DemoClass = new DemoClass();
public function Main() {
demo.setData(result);
}
public function result():void {
trace("我就是回调函数!")
}
}
}
package {
import flash.display.MovieClip
public class DemoClass extends MovieClip {
protected var m_onFun:Function;
public function DemoClass() {
}
public function setData(onFun:Function):void {
onFun();
}
public function onClick():void {
}
}
}