简体   繁体   English

外部AS2 SWF的预加载器

[英]preloader for external as2 swf

all i need is a preloader to run and when it detects the swf is loaded it will stop and the map.swf will start to run. 我需要做的是运行一个预加载器,当它检测到swf已加载时,它将停止并且map.swf将开始运行。 I have trawled the net for weeks with no luck. 我已经拖网了好几个星期,没有运气。 I have a massive 776kb flash map. 我有一个庞大的776kb闪存地图。 I need a preloader to run prior to this map but it need to be a preloader independant of the map.swf. 我需要一个预加载器在此映射之前运行,但它必须是独立于map.swf的预加载器。 Please does anyone have any ideas at all. 请任何人有任何想法。 i really would appreciate some help. 我真的很感谢您的帮助。 thanks in advance 提前致谢

okay found it: http://actionscripts.org/forums/showthread.php3?t=74988&highlight=preloader+tutorial+MX+2004 可以找到它: http : //actionscripts.org/forums/showthread.php3?t=74988&highlight=preloader+tutorial+MX+2004

stop();

//----- //-------------preloader------ //make the preloader bar not appear "full" right away bar_mc._xscale = 0; // ----- // ------------- preloader ------ //使预加载器栏不立即显示为“ full” bar_mc._xscale = 0; //load Movie into level 1 loadMovieNum("yourMovie.swf", 1); //将电影加载到1级loadMovieNum(“ yourMovie.swf”,1); //please note the movie to load has a blank first frame. //请注意,要加载的电影的第一帧为空白。 _level1.stop(); _level1.stop(); onEnterFrame = function () { // get the bytes of Level 1 and make into a percent percent = Math.ceil((_level1.getBytesLoaded()/_level1.getBytesTotal())*100); onEnterFrame = function(){//获取级别1的字节,并制成百分比百分比= Math.ceil((_ level1.getBytesLoaded()/ _ level1.getBytesTotal())* 100); //use the percent to determine the xscale of the preloader bar. //使用百分比确定预加载器栏的xscale。 bar_mc._xscale = percent; bar_mc._xscale =百分比; // if loaded play level1 if (percent>99) { //note you MUST delete onEnterFrame otherwise it //will continue to run and play just frame 2 forever. // //如果加载了play level1 if(percent> 99){//注意您必须删除onEnterFrame,否则它将继续运行并永远只播放第2帧。 delete this.onEnterFrame; 删除this.onEnterFrame; _level1.gotoAndPlay(2); _level1.gotoAndPlay(2);

}

}; };

basically this is completely separate to my main external swf.. Just make sure you put it in the same folder and call it with all the file structure intact otherwise it will not work. 基本上,这与我的主要外部SWF文件是完全分开的。只需确保将其放在同一文件夹中,并以完整的所有文件结构调用它,否则它将无法正常工作。 And it is the same height and width as the external swf i am calling - I have replaced the frame to play to go to frame 1 because that is where a load of my code starts from in the external fla. 它的高度和宽度与我要调用的外部SWF高度和宽度相同-我已经替换了要播放的帧以转到第1帧,因为那是我的代码负载从外部fla开始的地方。 Works a treat. 工作请客。 Also the last reference with a frame number (2) i have change to frame 1 also so it plays from start of externa swf. 同样,帧号为(2)的最后一个参考i也已更改为帧1,因此它从externa swf开始播放。 cool..... 凉.....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM