我正在使用下面的代码来加载外部 mp3 文件:
//Create an instance of the Sound class
var soundClip:Sound=new Sound();
//Create a new SoundChannel Object
var sndChannel:SoundChannel=new SoundChannel();
//Load sound using URLRequest
soundClip.load(new URLRequest("namesounds/agamemnonas.mp3"));
//Create an event listener that wll update once sound has finished loading
soundClip.addEventListener(Event.COMPLETE,onComplete,false,0,true);
function onComplete(evt:Event):void {
//Play loaded sound
sndChannel=soundClip.play();
}
同样在我的 html 中,我有一个下拉列表:
<select name="sounds" id="sounds">
<option value="sounds/eden.mp3" selected="selected">eden</option>
<option value="sounds/zeus.mp3">zeus</option>
<option value="sounds/earth.mp3">earth</option>
</select>
是否可以将下拉菜单中的路径发送到 Flash 文件?例如:
//Load sound using URLRequest
soundClip.load(new URLRequest("namesounds/agamemnonas.mp3"));
URLRequest 必须是来自我的 .php 文件的下拉菜单列表的路径。