Back to "flash Basic Theory Class-Catalog"
Ideas:
1. Make a 100-frame reading animation, which can make a variety of loading effects;
2. Percentage read (percent) = bytes Read/total bytes *100;
3. Stop to the corresponding frame of the movie clip (Loading) based on the percentage of reads (percent).
Step 1:
Make a 100-frame loading animation, save as a movie clip, put on the stage, instance named loading
Step 2:
Add as code in the first frame
stop();
_root.onEnterFrame = function() {
var percent = Math.floor(getBytesLoaded()/getBytesTotal()*100);
//变量percent保存读取的百分比数
loading.gotoAndStop(percent);
//停止到影片剪辑 Loading 的相应帧上
if (percent == 100) {
_root.play();
//percent=100时,说明读取完毕,整个动画开始播放
}
};
Flash charge 1:getbytesloaded () and Getbytestotal ()
Getbytesloaded (): Gets the number of bytes read
Getbytestotal (): Gets the total number of bytes in the entire SWF file
Flash Charge 2: How to test whether the loading of the production is successful
1. Test loading must be used in the test film (Ctrl+enter);
2. We can import 2 larger pictures to occupy the byte number after frame 2nd;
3. After the test film (Ctrl+enter), select the view in the window-> Download Settings->dsl;
4. Select View-> Simulate Download (ctrl+enter) in the window.