A调用B,
B写:
fl.outputPanel.clear(); //第4种写法 var Circle={ "doc":null, "PI":3.14159, "area":function(r){ return this.PI * r * r; }, "excute":function (_wSize){ this.doc.width = _wSize; } };
A写:
//不带文件名路径但带斜杠 如:abc/ var main_Url = fl.scriptURI.substr(0, fl.scriptURI.lastIndexOf("/") + 1); fl.runScript(main_Url + "A.jsfl"); Circle.doc=fl.getDocumentDOM(); Circle.excute(50); alert( Circle.area(1.0) );
打开fla,新建文档,打开A.jsfl,运行