手机
当前位置:查字典教程网 >网页设计 >Flash教程 >flash加载各种外部文件
flash加载各种外部文件
摘要:加载外部swf到层复制代码代码如下:onClipEvent(load){this.gotoAndstop(1);}onClipEvent(e...

加载外部swf到层

复制代码 代码如下:onClipEvent(load){

this.gotoAndstop(1);

}

onClipEvent(enterFrame){

now=level2.getBytesLoaded()

all=level2.getBytesTotal()

loaded=int(now/all*100);

this.gotoAndStop(loaded);

this.bfb=loaded+"%";

if(now==all){

_root.gotoAndPlay("begin");

}

}

加载到MC

复制代码 代码如下:

this.onEnterFrame=function(){

if(this.getBytesLoaded()<this.getBytesTotal()){

Total=this.getBytesTotal()/1000;

Received=this.getBytesLoaded()/1000;

Percentage=(Received/Total)*100;

loaded=int(Received/Total*100);

percent=loaded+"%";

_root.player.musicper=this.percent;

_root.player.musicbar.gotoAndStop(int(Percentage));

}else{

gotoAndPlay(2);

this.onEnterFrame=null;

}

};

stop();

加载记事本文件

复制代码 代码如下:

mytxtData=newLoadVars();

mytxtData.onData=function(rw){

if(rw.indexOf("rn")>-1){

trace("oker");

}

a_txt.text=replacePunc(rw);

};

functionreplacePunc(str){

vartempArray=str.split("rn");

vartempstr=newString();

for(vari=0;i<tempArray.length;i++){

tempstr+=tempArray[i]+newline;

}

returntempstr;

}

System.useCodepage=true;

mytxtData.load("mydata.txt");

加载XML文件

复制代码 代码如下:

vardoc1=newXML();

//---------------------

doc1.ignoreWhite=true;

doc1.load("data.xml");

doc1.onLoad=function(success){

if(success){

e=doc1.firstChild.firstChild;

a=e.attributes.kind;

b=e.childNodes[0].firstChild.nodeValue;

c=e.childNodes[1].firstChild.nodeValue;

d=e.childNodes[2].firstChild.nodeValue;

text1=a+"----------"+b+"----------"+c+"----------"+d;

}else{

trace("载入失败");

}

};

stop();

直接载入图片

复制代码 代码如下:

pic=newArray();

for(i;i<9;i++){

pic[i]="mypic"+i+".jpg";

loadMovie(pic[i],"mc"+i);

trace(pic[i]);

}

载入MP3音乐(直接)

复制代码 代码如下:

myMusic=newSound(_root.mySound);

myMusic.loadSound("song1.mp3",false);

myMusic.setVolume(130);

varplaying=false;

preloading=true;

this.onEnterFrame=function(){

mTotal=_root.myMusic.getBytesTotal();

mLoaded=_root.myMusic.getBytesLoaded();

if(preloading==true&&mLoaded>0){

mPercent=Math.round((mLoaded/mTotal)*100);

_root.preloader._visible=true;

_root.preloader.mFiller._xscale=mPercent;

if(mPercent>=100){

myMusic.start(0,999);

preloading=false;

playing=true;

_root.preloader._visible=false;

deletethis.onEnterFrame;

}

}

};

【flash加载各种外部文件】相关文章:

as3 加载外部声音文件问题详细剖析

flash声音与歌词同步的三种方法

Flash中如何调用exe可执行文件?

几款经典Flash源文件集锦-导航篇

Flash动画设计整体知识体系介绍

flash中添加音乐的三种方式

Flash加载外部文件创建进度条3种方法

Flash AS 入门教程 调入外部文本和加载外部mp3文件

Flash元素必须用外部的脚本创建

Flash cs4中按钮添加链接网页代码

精品推荐
分类导航