在使用as3.0中,想要一个SWF文件(假设为1.swf)加载另一个SWF文件(假设为2.swf),并且1.swf调用2.swf文件里的方法,方法如下:
1.swf:
var url:String = "2.swf";
var req:URLRequest = new URLRequest(url);
var myLoader:Loader = new Loader();
myLoader.load(req);
myLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,completeHandler);


function completeHandler(evt)...{
evt.target.content.sayHello("朋友");
}
2.swf:

package...{
import flash.display.Sprite;

public class MainForm extends Sprite...{

public function MainForm()...{
}

public function sayHello(str)...{
trace("hello!"+str);
}
}
}
1.swf:



























