Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using allowScriptAccess with Flash MP3 Player

Community Beginner ,
Nov 01, 2008 Nov 01, 2008
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.
TOPICS
ActionScript
666
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Nov 01, 2008 Nov 01, 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#addC...
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 03, 2008 Nov 03, 2008
LATEST
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.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines