I am using the code below to load an external mp3 file:
//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();
}
Also in my html I have a drop down list:
<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>
Is it possible to send a path from a drop down menu to a flash file?
For example:
//Load sound using URLRequest
soundClip.load(new URLRequest("namesounds/agamemnonas.mp3"));
The URLRequest must be the path from drop down menu list from my .php file.
You’ll have to use
ExternalInterface.addCallbackin your AS and call that function from javascriptAS3
Pure Javascript
OR
jQuery
Don’t forget to set your
allowscriptaccessof theobject/embedto the correct value so the page can communicate with the flash object