Rss & SiteMap

康柏仕电脑学院 index.asp

康柏仕电脑学院--台湾正航ERP软件售后技术论坛,客服热线0769-81158210
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[技巧]判断外部影片载入进度的两种方法

1楼
轻轻风聆 发表于:2007/8/24 8:46:35

方法一(推荐):MovieClipLoader方法

var mcContainer:MovieClip = this.createEmptyMovieClip("myMC", this.getNextHighestDepth());
var mcLoader:MovieClipLoader = new MovieClipLoader();
var mcListener:Object = new Object();
mcListener.onLoadProgress = function(target:MovieClip, bytesLoaded:Number, bytesTotal:Number) {
trace(Math.floor((bytesLoaded/bytesTotal)*100)+"%");
}
mcListener.onLoadInit = function(target:MovieClip):Void {
trace(target._name + " loadedComplete");
}
mcLoader.addListener(mcListener);
mcLoader.loadClip("picImg/pic1.jpg", "myMC");


//方法二:onEnterFrame方法

this.createEmptyMovieClip("tempMC", this.getNextHighestDepth());
this.createEmptyMovieClip("loaderMC", this.getNextHighestDepth());
loaderMC.loadMovie("picImg/pic1.jpg");
tempMC.onEnterFrame = function() {
var loaded = loaderMC.getBytesLoaded();
var loadTotal = loaderMC.getBytesTotal();
trace(int((loaded/loadTotal)*100)+"%");
//此处很奇异,判断是否加载完要用((loaded/loadTotal) == 1)而不能用(loaded == loadTotal)
if((loaded/loadTotal) == 1){
delete this.onEnterFrame;
trace("loadedComplete");
}
}

共2 条记录, 每页显示 10 条, 页签: [1]

Copyright ©2005 - 2024 康柏仕电脑学院 清理缓存

正航ERP软件-企业ERP最佳选择! http://www.chidg.com  0769-81158210
Powered By Dvbbs Version 8.3.0
Processed in .01563 s, 2 queries.