Flash制作简单MP3播放器.docxVIP

  • 3
  • 0
  • 约1.8千字
  • 约 4页
  • 2023-08-06 发布于湖北
  • 举报
Flash 制作简单 Flash 制作简单 MP3 播放器 首先创建几个按钮,放在第一桢,点击按钮在按钮上写下如下代码 on(release){ 创建一个函数,使音乐文件加载到 25%才开始播放,要不然从网上加载的时候会卡。function zairu(){ if(b=25){ mysound.start(0,10); 如果加载到 25%就清除。clearInterval(poll); } } poll=setInterval(zairu,100); yinyue(你要加载的MP3 地址); } 回到主场景,创建 回到主场景,创建 2 个动态文本,变量名分别命为txt1,txt2,txt3, function yinyue(name){ function yinyue(name){ 建立声音对象,方便控制声音mysound=new Sound(this); 载入声音 mysound.loadSound(name,true); 在这里先停止声音,不然声音会加载到能启动解压程序时自动播放 mysound.stop(name); } function loading(){ 已加载声音大小l=mysound.getBytesLoaded(); 声音总大小m=mysound.getBytesTotal(); b=int(l/m*100); txt1=b+%; txt2=int(l/1000)/1000+M+/+int(m/1000)/1000+M; 已播放声音时间 time=int(mysound.position/1000); 声音总时间time2=int(mysound.duration/1000); s1=time; if(s110){ s1=0+s1; } txt3=已播放: +s1+秒; loading21.loading3._xscale=b; 设置声音的音量大小, mysound.setVolume((huakuai2.huakuai._x+50)*2); } 定时器触发时间为 100 毫秒一次,使上面设置的变量不断更新setInterval(loading,100); 创建播放,暂停,快进,快退按钮分别写AS on(release){ this.mysound.start(this.mysound.position/1000,1); } on(release){this.mysound.stop();} on(release){ this.mysound.start((this.mysound.position/1000)+10,1); } on(release){ this.mysound.start((this.mysound.position/1000)-10,1); } @作-按钮 @ 卫L叩 屯声 目。 .一111l- =__ =_____ 0 }+ 10@@@G,歹釭寸 0 }+ 10 @@@G _ I on Cr e1 径 r-· :) { 妇,毛芯 c·e五 巹 s· 民 0 p t3.12, .} 3ow-Ld , st ;j !:·. t ( (t h i s , 肌y 5OU、l ld.工i :心辽Lt 勹im} 勹 i m l I:.11 Li l OI) j 1 }I 一^一了1_v江 o p 且 一^ 一了1 _ v ,冒司,m ,冒司 , m. ` ~·__1,^当可选择 ~ · _ _ 1 , ^ gI g I ,夕圈1 m .B万g 屯 l. ..,.a.d t . B 万 1l ” d h 屯 1 芒 h m g j :i 直忍 勹 雪 ` 心 · --- · --- ·-·- 酝打忙 旧 叩 5f: ( 亡玉吕) .....- ·-·一,. 圈· , : I ` .-l 一 - — .- ...f. ,;...-.-.``` ...,., .,. 鬻 I -- 扈 r ?: :. -一一- -一·.-一,.-·-飞 --.·--····--··--·.--·. -一飞-.-.- --------·心-------.-.,二.一,.,....., 瞿...匮. 即冒 .` .. 刁 -- -. ,t

文档评论(0)

1亿VIP精品文档

相关文档