【发布时间】:2015-11-29 12:29:54
【问题描述】:
有手册http://sonoport.com/manual/如何使用as3库来播放带有音频过滤器的音频。我需要工具 AudioStretch 但首先尝试简单地播放音频外部链接。
我在做什么。
- 我使用mxmlc编译器,所以包含SonoportCollection.swc
- 导入com.sonoport.MP3PlayerSound;
- 尝试创建和播放
代码:
mp3PlayerSnd = new MP3PlayerSound();
mp3PlayerSnd.audioFile = "http_url_link.mp3";
mp3PlayerSnd.play();
所以,什么都没有。我看到 http get to server for link http_url_link.mp3 发送正常。但是没有声音。我做错了什么?
已更新。我试试测试
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
import com.sonoport.MP3PlayerSound;
public class Pitcher extends Sprite {
protected var trackSound:Sound;
protected var trackChannel:SoundChannel;
protected var _mp3_path:String;
public function Pitcher():void {
_mp3_path = 'http_path_to_audio_mp3';
trackSound = new Sound();
trackSound.load(new URLRequest(_mp3_path));
trackChannel = trackSound.play();
}
}
}
这工作很好!当我在浏览器中打开 .swf 文件时,音乐正在播放
package {
import flash.display.Sprite;
import flash.events.*;
import flash.net.URLRequest;
import flash.media.Sound;
import flash.media.SoundChannel;
import flash.media.SoundTransform;
import com.sonoport.MP3PlayerSound;
public class Pitcher extends Sprite {
protected var trackSound:Sound;
protected var trackChannel:SoundChannel;
protected var _mp3_path:String;
public function Pitcher():void {
var snd:MP3PlayerSound;
snd = new MP3PlayerSound();
snd.gain = 1;
snd.audioFile = 'http_path_to_audio_mp3';
snd.play();
}
}
}
这不起作用。当我在浏览器中打开 .swf 文件时,我看到对服务器的 mp3 文件的 http 请求已完成,但没有音乐...
我使用 util mxmlc 编译 AS3 代码。有些人喜欢这个命令
"cd #{as3_path}; #{mxmlc} -include-libraries=SonoportCollection.swc -warnings=false -debug=false -static-link-runtime-shared-libraries=true -optimize=true -o #{swf_file} -file-specs #{as3_file}"
我的编译器命令可能有问题? 附言。我不是 Flash 开发者
【问题讨论】:
标签: actionscript-3 actionscript