flash 同步加载多个外部swf的方法
flash 同步加载多个外部swf的方法
//参数分别是文件数量,起点x,起点y,宽度比例,高度比例,排列间距.
//注意外部文件分别为0.swf,1.swf,2.swf.........递增的,其实稍微改下,加载图片也一样
function manyloadmovie(num, x, y, xscal, yscal, dis) {
for (var i = 0; i<num; i++) {
var temp = createemptymovieclip("temp"+i, i);
var l = createemptymovieclip("load"+i, i+num);
temp.t = i;
l.loadmovie(i+".swf");
l._xscale = xscal;
l._yscale = yscal;
l._x = x+i*dis;
l._y = y;
t = createtextfield("txt"+i, i+10000, l._x, l._y, 100, 100);
temp.onenterframe = function() {
var a = this._parent["load"+this.t].getbytesloaded();
var b = this._parent["load"+this.t].getbytestotal();
this._parent["txt"+this.t].text = int(a*100/b)+"%";
if (a>=b and a>10) {
this._parent["txt"+this.t].removetextfield();
this.removemovieclip();
}
};
}
}
manyloadmovie(4, 100, 100, 50, 50, 50);
补充:flash教程,动画技术