如何將php作爲變量引入路徑?我有數百個存儲在My SQL數據庫中的mp3文件名,我想調用該名稱,將其加載到一個變量中,然後在調用該聲音文件時將其替換爲URL。我所有的東西都是PHP和數據庫的一面,但我一直對Flash部分感到沮喪。我認爲這只是將一個變量從php傳遞給flash。我們正在構建的網頁最終每頁有10-15個文件,每個文件都會有不同的聲音文件和不同的圖像,您可以通過點擊來觸發聲音。第一次點擊會啓動文件,第二次會停止聲音。圖像和聲音文件都存儲在數據庫中。將變量傳遞給PHP/MySQL中的actionscript以播放音頻文件
我在另一篇文章中發現了這段代碼,它基本上是我想要做的。仍然缺少按鈕部分,但如果我能從PHP中找出變量,我認爲它會打開一堆新選項。
var soundRequest:URLRequest = "path/to/file.mp3"; //the path would be a variable passed from the database to php and then to the actionscript var s:Sound = new Sound(soundRequest); var sChannel = s.play(0, int.MAX_VALUE); //Causes it to repeat by the highest possible number to flash. //Above starts the sound immediatly (Streaming); //Now to wait for completion instead, pretend we didnt start it before. s.addEventLister(Event.SOUND_COMPLETE, onSComplete, false, 0, true); function onSComplete(e:Event):void { var sChannel = s.play(0, int.MAX_VALUE); //Causes it to repeat by the highest possible }
+1這是偉大的,我喜歡它。 – 2010-11-27 06:38:50