开发者

Preloading external swfs with AS2

I've found this bit of code and it works for preloading my single 'Q1.swf' in an old AS2 project I did a while back. How do I adapt it to preload 5 swf's? Ca开发者_如何学编程n I load them all to the same target mc or do I have to load them on separate levels or to different targets. I don't want to change the project to AS3 as the budget doesn't allow. Also will this work when the project is viewed from a CD as well as online?

stop();
preloader._visible = false;
preloader.bar._xscale = 0;
var mclListener:Object = new Object();
mclListener.onLoadInit = function(container:MovieClip) {
trace('initialized');
};
mclListener.onLoadStart = function(container:MovieClip) {
preloader._visible = true;
trace('started');
};
mclListener.onLoadProgress = function(mc, w, t) {
trace('progress: '+w+", "+t);
var w = container.getBytesLoaded();
var t = container.getBytesTotal();
preloader.percent = Math.round(w/t*100)+"%";
preloader.bar._xscale = Math.round(w/t*100);
};
mclListener.onLoadComplete = function(container:MovieClip) {
trace("loaded");
preloader._visible = false;
_root.play();
};
mclListener.onLoadError = function(container:MovieClip, errorCode:String) {
preloader._visible = false;
trace('not loaded');
};
var container1:MovieClipLoader = new MovieClipLoader();
container1.addListener(mclListener);
container1.loadClip("Q1.swf", container);


i do something like this:

function loadSection() {
    ext_mc.loadMovie("01.swf");
    bg_mc.loadMovie("bg.swf");  

    _root.createEmptyMovieClip("ctrl_mc",_root.getNextHighestDepth());
    _root.ctrl_mc.onEnterFrame = function() {
        vbt = ext_mc.getBytesTotal() + bg_mc.getBytesTotal()
        vbl = ext_mc.getBytesLoaded() + bg_mc.getBytesLoaded()
        if (vbl >= vbt && vbl > 200) {

            delete _root.ctrl_mc.onEnterFrame;              
             trace("do something")
        }
    };
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜