Skip to main content
Known Participant
November 1, 2008
Question

Using allowScriptAccess with Flash MP3 Player

  • November 1, 2008
  • 2 replies
  • 707 views
I am working on a music web site and have an AS3 MP3 player that effectively plays from an XML list. However, I need to be able to direct the player to play from a list of songs in an html page.

To do this I have included the parameter to allowScriptAccess always. I have embedded the MP3 player using swfObject (see the attached code) but there is some kind of communication missing between the script and the player.

Any suggestions will be greatly appreciated.

Thanks.
This topic has been closed for replies.

2 replies

Known Participant
November 3, 2008
Andrei1,

I am using the ExternalInterface.addCallback() method as follows:

ExternalInterface.addCallback("playSong", loadTrack);

I reviewed the livedocs reference you provided above, but I am not sure how to adapt this code:

<script language="JavaScript">
var jsReady = false;
function isReady() {
return jsReady;
}
function pageInit() {
jsReady = true;
document.forms["form1"].output.value += "\n" + "JavaScript is ready.\n";
}
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
function sendToActionScript(value) {
thisMovie("ExternalInterfaceExample").sendToActionScript(value);
}
function sendToJavaScript(value) {
document.forms["form1"].output.value += "ActionScript says: " + value + "\n";
}
</script>

to my situation. Is it possible to get some guidance on this? In my current project I am working with mp3 sound files.

Any guidance you can provide would be greatly appreciated.

Thank you.
Inspiring
November 1, 2008
I am not sure you can communicate with swf via reference to the object.

A native way to accomplish what you need would be to use ExternalInterface.addCallback() method.

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html#addCallback()