参考页面
[url=http://www.muchina.com/intro/intro_2006.htm]
[color="#ff0000"]http://www.muchina.com/intro/intro_2006.htm[/color]
[/url]
1.开始当然是要stop()第一帧;
2.把所有需要导入的文件路径放在数组中,(文件格式只包括swf和jpg)把需要显示层级高的放在数组的后面。如下:
var arr_swf = new Array();
arr_swf[0] = "LeftGuy.swf";
arr_swf[1] = "RightBg.swf";
arr_swf[2] = "RightTitle.swf";
arr_swf[3] = "RightBorder.swf";
arr_swf[4] = "Menu.swf";
arr_swf[5] = "Banner.swf";
arr_swf[6] = "SwitchGuy.swf";
arr_swf[7] = "ToHome.swf";
_root.cur_swf = 0; //当前所指向的arr_swf数组的游标
function load_swf(str_swf, int_level) {
var my_mcl = new MovieClipLoader();
myListener = new Object();
myListener.onLoadStart = function(target_mc) {
var loadProgress = my_mcl.getProgress(target_mc);
_root.mc_loading.loading.text = Math.round(100*loadProgress.bytesLoaded/loadProgress.bytesTotal)+"% ("+str_swf+")";
};
myListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
trace(Math.round(100*loadedBytes/totalBytes)+"% ("+str_swf+")");
_root.mc_loading.loading.text = Math.round(100*loadedBytes/totalBytes)+"% ("+str_swf+")";
};
myListener.onLoadComplete = function(target_mc) {
var loadProgress = my_mcl.getProgress(target_mc);
_root.mc_loading.loading.text = Math.round(100*loadProgress.bytesLoaded/loadProgress.bytesTotal)+"% ("+str_swf+")";
if (int_level
其中
[color="#ff0000"]onLoadComplete[/color]
事件用了一个递归,当数组里的文件没有被下载完全时,就会一直调用这个函数;反之,退出广播,跳入到下一帧。
4.最后,上面的是函数的定义,当然还要调用它才能运行
load_swf(arr_swf[_root.cur_swf], _root.cur_swf+1);3.用MovieClipLoader类来完成主要函数
[color="#009900"][/color]
本文转自:http://www.5uflash.com/flashjiaocheng/Flash-loadingjiaocheng/2060.html
[url=http://www.muchina.com/intro/intro_2006.htm]
[color="#ff0000"]http://www.muchina.com/intro/intro_2006.htm[/color]
[/url]
1.开始当然是要stop()第一帧;
2.把所有需要导入的文件路径放在数组中,(文件格式只包括swf和jpg)把需要显示层级高的放在数组的后面。如下:
var arr_swf = new Array();
arr_swf[0] = "LeftGuy.swf";
arr_swf[1] = "RightBg.swf";
arr_swf[2] = "RightTitle.swf";
arr_swf[3] = "RightBorder.swf";
arr_swf[4] = "Menu.swf";
arr_swf[5] = "Banner.swf";
arr_swf[6] = "SwitchGuy.swf";
arr_swf[7] = "ToHome.swf";
_root.cur_swf = 0; //当前所指向的arr_swf数组的游标
function load_swf(str_swf, int_level) {
var my_mcl = new MovieClipLoader();
myListener = new Object();
myListener.onLoadStart = function(target_mc) {
var loadProgress = my_mcl.getProgress(target_mc);
_root.mc_loading.loading.text = Math.round(100*loadProgress.bytesLoaded/loadProgress.bytesTotal)+"% ("+str_swf+")";
};
myListener.onLoadProgress = function(target_mc, loadedBytes, totalBytes) {
trace(Math.round(100*loadedBytes/totalBytes)+"% ("+str_swf+")");
_root.mc_loading.loading.text = Math.round(100*loadedBytes/totalBytes)+"% ("+str_swf+")";
};
myListener.onLoadComplete = function(target_mc) {
var loadProgress = my_mcl.getProgress(target_mc);
_root.mc_loading.loading.text = Math.round(100*loadProgress.bytesLoaded/loadProgress.bytesTotal)+"% ("+str_swf+")";
if (int_level
其中
[color="#ff0000"]onLoadComplete[/color]
事件用了一个递归,当数组里的文件没有被下载完全时,就会一直调用这个函数;反之,退出广播,跳入到下一帧。
4.最后,上面的是函数的定义,当然还要调用它才能运行
load_swf(arr_swf[_root.cur_swf], _root.cur_swf+1);3.用MovieClipLoader类来完成主要函数
[color="#009900"][/color]
本文转自:http://www.5uflash.com/flashjiaocheng/Flash-loadingjiaocheng/2060.html