我只是需要一些关于如何在Javascript上点击播放音频片段的方向。
答案 0 :(得分:0)
为了在flash和javascript之间来回交谈,你应该使用flash.external.ExternalInterface类和回调。
import flash.external.ExternalInterface;
import flash.net.URLRequest;
//Create the javascript "playSound" on the swf object
ExternalInterface.addCallback("playSound", playSound);
//Create our sound object
var sound:Sound = new Sound;
//Load my.mp3 into our sound object
sound:Sound .load(new URLRequest("my.mp3"));
function playSound(){
sound.play();
}
<script language="javascript">
var swf;
//Wait for page load to complete
window.onload = init;
//initialize our swf variable where mySWF is the id of the swf object on the page
function init(){
swf = document.getElementById("mySWF");
}
//call our external function on the swf
function playSound(){
swf.playSound();
}
</script>
原谅我有任何错误,代码未经测试但应该给你正确的想法。