发一个FLASH加载loading动画效果
制作的FLASH如果比较大,网页不能瞬间下载下来,就会在装载过程中等待数秒的空白,于是我们制作一个简短的loading来提示用户。发一个FLASH加载loading动画效果,包括代码,你可以在帧后边直接加你的FLASH,还有一个最简单的办法就是,新建一个场景,再这个动画播放完成之后,再加载第二个场景gotoAndPlay("场景名",1)关键点分析与常见问题
1.要变的文字要设置成动态文本。
2.在库面板中将影片剪辑或声音的链接设置中的"在第一帧导出"去掉,防止第一帧过大而导致加载不畅。
//影片加载时
onClipEvent (load) {
//将影片总字节数赋给变量total
total = _root.getBytesTotal();
}
//进入影片时
onClipEvent (enterFrame) {
//将影片已下载的字节数赋给变量loaded
loaded = _root。getBytesLoaded();
//将已下载的除以总字节数,再乘以100,于是得到目前已下载字节的百分比
percent = int(loaded/total*100);
//让text动态文本来显示下载的百分比。
text = percent+"%";
//让影片停在当前下载的位置。
gotoAndStop(percent);
//判断已下载的字节数是否等于总字节数,如果为真,则跳到并播放第2帧。
if (loaded == total) {
_root.gotoAndPlay(2);
}
}
//如果是简单代码
//
a = getBytesLoaded();
b = getBytesTotal();
x = a;
y = b;
loaded = int(x / y * 100);
bar.gotoAndStop(loaded);
//
if (x == y)
{
gotoAndPlay("start");
}
else
{
gotoAndPlay("load1");
} // end else if
percentageLoaded = Math.round(_root.getBytesLoaded() / _root.getBytesTotal()*100);
if (currentFrame == null) {
currentFrame = 0; // initialise the first time around
}
if (currentFrame < 100) {
if (percentageLoaded > currentFrame) {
myLoadingText.text = currentFrame;
currentFrame++;
this._parent.circleLoader.loader.loaderMask.gotoAndStop(currentFrame);
}
} else {
myLoadingText.text = "OK";
stop();
_root.gotoAndPlay("fei76");
}
如果想加按钮on (release)
{
getURL("http://www.029263.com","_blank");
}http://www.xytk.com/data/attachment/forum/201105/30/0233522iqhuqfwtwuuy2lu.jpg
**** Hidden Message ***** 看看!!! 发vf cbcbcbvc
页:
[1]