Sound加载音乐的问题
时间:2011-06-22
来源:互联网
我用sound加载了一个外部的mp3 在本地测试没有问题。上传到网络以后播放的话总有个异常
ArgumentError: Error #2068: 声音无效。
at flash.media::Sound/play()
at main_fla::MainTimeline/IsGotoAndPlay()
舞台上总共有三个场景 我将Sound设这成了static 方便三个场景都能引用,不知问题出在哪里。各位帮忙解决下,目前不知道问题出在哪里
ArgumentError: Error #2068: 声音无效。
at flash.media::Sound/play()
at main_fla::MainTimeline/IsGotoAndPlay()
舞台上总共有三个场景 我将Sound设这成了static 方便三个场景都能引用,不知问题出在哪里。各位帮忙解决下,目前不知道问题出在哪里
复制内容到剪贴板
var loaded:Number;
var percent:Number;
var l1:Boolean = false;
var l2:Boolean = false;
var p1:Number = 0;
var p2:Number = 0;
this.addEventListener(Event.ENTER_FRAME,IsGotoAndPlay);
loading.addEventListener( Event.ENTER_FRAME, load_progress );
GlobalSound.sound_ = new Sound(new URLRequest("yinyue.mp3"));
GlobalSound.sound_.addEventListener(ProgressEvent.PROGRESS,loadingMusic);
GlobalSound.sound_.addEventListener(Event.COMPLETE,loadingMusicC);
function loadingMusic(e:Event){
p2 = Math.floor(GlobalSound.sound_.bytesLoaded*100/GlobalSound.sound_.bytesTotal);
this.txt_m.text = p2+"%";
}
function loadingMusicC(e:Event){ l2 = true;}
function IsGotoAndPlay(e:Event){
if(l1&&l2){ this.removeEventListener(Event.ENTER_FRAME,IsGotoAndPlay);
this.loading.txt_load.text = "100%";
this.loading.mask_bar.y = 0;
GlobalSound.channel = GlobalSound.sound_.play();
//play();
}
else{
this.loading.txt_load.text = Math.floor((p1+p2)/2)+"%"; this.loading.mask_bar.y = 60*(1-(p1+p2)/200);
}
}
function load_progress(e:Event):void
{
loaded = stage.loaderInfo.bytesLoaded / stage.loaderInfo.bytesTotal;
percent = Math.floor(loaded * 100);
p1 = percent;
this.txt_m2.text = p1 + "%";
if( percent == 100 )
{
this.txt_m2.text = "影片完成!";
this.loading.removeEventListener( Event.ENTER_FRAME, load_progress );
l1=true;
//play();
}
}
代码:
stop();var loaded:Number;
var percent:Number;
var l1:Boolean = false;
var l2:Boolean = false;
var p1:Number = 0;
var p2:Number = 0;
this.addEventListener(Event.ENTER_FRAME,IsGotoAndPlay);
loading.addEventListener( Event.ENTER_FRAME, load_progress );
GlobalSound.sound_ = new Sound(new URLRequest("yinyue.mp3"));
GlobalSound.sound_.addEventListener(ProgressEvent.PROGRESS,loadingMusic);
GlobalSound.sound_.addEventListener(Event.COMPLETE,loadingMusicC);
function loadingMusic(e:Event){
p2 = Math.floor(GlobalSound.sound_.bytesLoaded*100/GlobalSound.sound_.bytesTotal);
this.txt_m.text = p2+"%";
}
function loadingMusicC(e:Event){ l2 = true;}
function IsGotoAndPlay(e:Event){
if(l1&&l2){ this.removeEventListener(Event.ENTER_FRAME,IsGotoAndPlay);
this.loading.txt_load.text = "100%";
this.loading.mask_bar.y = 0;
GlobalSound.channel = GlobalSound.sound_.play();
//play();
}
else{
this.loading.txt_load.text = Math.floor((p1+p2)/2)+"%"; this.loading.mask_bar.y = 60*(1-(p1+p2)/200);
}
}
function load_progress(e:Event):void
{
loaded = stage.loaderInfo.bytesLoaded / stage.loaderInfo.bytesTotal;
percent = Math.floor(loaded * 100);
p1 = percent;
this.txt_m2.text = p1 + "%";
if( percent == 100 )
{
this.txt_m2.text = "影片完成!";
this.loading.removeEventListener( Event.ENTER_FRAME, load_progress );
l1=true;
//play();
}
}
作者: sdmajun 发布时间: 2011-06-22
无文件无真像,到处发帖子,不如发文件。
作者: flash023 发布时间: 2011-06-22
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28