as2与as3应用
来源:互联网 发布:mac appstore关闭更新 编辑:程序博客网 时间:2024/06/14 08:13
/*2009.6.25
as2.0播放器*/
代码有点简单:
var temp;
temp = 1;
function aa() {
mysound = new Sound();
mymusic_array = new Array("1.mp3", "2.mp3", "3.mp3", "4.mp3", "5.mp3");
mysound.loadSound(mymusic_array[temp-1],true);
mysound.onLoad = function(success) {
if (success) {
mysound.start(0);
}
};
mysound.onSoundComplete = function() {
temp++;
if (temp>5) {
temp = 1;
}
aa();
};
}
onEnterFrame = function () {
myarray = new Array("爱情呼叫转移", "青花瓷", "track", "洛丽塔", "白色恋人");
music_name = myarray[temp-1];
zongchangdu = "总长:"+int(mysound.duration/1000)+"秒";
yibofang = "已播放:"+int(mysound.position/1000)+"秒";
huanchong = "缓冲:"+int(mysound.getBytesLoaded()/mysound.getBytesTotal()*100)+"%";
_root.kongzhitiao.huakuai._x = 248*((int(mysound.position/1000))/(int(mysound.duration/1000)));
};
aa();
/*2009.11.25.as3.0播放器代码*/
/*2009.11.25 by Balloon*/
var playPP:Number;
var ctrlSnd:SoundChannel;
var mySong:Sound=new Sound();
mySong.load(new URLRequest("http://www.33477.cn/s.mp3"));
mySong.addEventListener(Event.OPEN,handler1);
mySong.addEventListener(ProgressEvent.PROGRESS,handler2);
mySong.addEventListener(Event.COMPLETE,handler3);
mySong.addEventListener(IOErrorEvent.IO_ERROR,handler4);
function handler1(e:Event) {
//trace("开始加载歌曲");
}
function handler2(e:ProgressEvent) {
bl_txt.text=String(e.bytesLoaded);
bt_txt.text=String(e.bytesTotal);
per_txt.text=int(e.bytesLoaded/e.bytesTotal*100)+"%";
}
function handler3(e:Event) {
ctrlSnd=mySong.play();
addEventListener(Event.ENTER_FRAME,pp);
}
function handler4(e:IOErrorEvent) {
//trace("加载出错!");
}
function pp(e:Event) {
playPP=ctrlSnd.position;
pp_txt.text="已播放"+int(ctrlSnd.position/1000)+"秒";
progressBar_mc.scaleX=ctrlSnd.position/mySong.length;
}
play_btn.addEventListener(MouseEvent.CLICK,playSnd);
pause_btn.addEventListener(MouseEvent.CLICK,pauseSnd);
stop_btn.addEventListener(MouseEvent.CLICK,stopSnd);
function stopSnd(e:MouseEvent) {
ctrlSnd.stop();
removeEventListener(Event.ENTER_FRAME,pp);
pp_txt.text="已停止";
progressBar_mc.scaleX=0;
playPP=0;
}
function playSnd(e:MouseEvent) {
ctrlSnd.stop();
ctrlSnd=mySong.play(playPP);
addEventListener(Event.ENTER_FRAME,pp);
}
function pauseSnd(e:MouseEvent) {
ctrlSnd.stop();
}
- as2与as3应用
- as3与as2的区别
- 【AS3与AS2通信】AVM2 (AS3) to AVM1 (AS2/AS1)
- AS2与AS3的主要差别
- 浅谈as2.0与as3.0
- 比较Flash AS3与AS2特性与功能
- AS3.0与AS2.0的差别大吗?
- 从AS2到AS3
- as2 as3 不同
- 关于AS2和AS3
- [AS3]AS3.0/AS2.0/Flex/Air介绍与区别说明
- 基础as2 转AS3笔记
- AS2 → AS3: LoadVars AS3 Equivalent
- AS2的fscommand应用
- AS2的实际应用
- as2和as3的性能比较
- As3 模拟As2.0 LoadVars传参
- AS2.0和AS3.0的区别
- Google将推 会提供手机间免费通话新系统
- linux下的GPIO驱动
- ExtJs的使用
- 百度在线网络技术(北京)有限公司 : 无线产品设计师_搜索新产品研发部
- Java 基础知识
- as2与as3应用
- 目前还比较菜~~
- 甲骨文宣布,推出最新数据集成解决方案Oracle GoldenGate
- 争先体味Oracle 11g的新特点
- 网管笔记35:不得不看的黑客工具集(转)
- ding~~~~~~~~~~~~~~~~~~~~~~~~~
- Cookie对象实战
- Oracle宣布对MySQL、GlassFish、NetBeans的将来计划
- 新手帖