views:

404

answers:

1

Hello all. I know there are an abundance of articles and forum post (many of them from myself) regarding ExternalInterface, I guess I'll add one more...

I have a small flash app (a button) which is set up to test the availability of ExternalInterface and it works great. I also have a larger, more complex, flash mp3 player, which I am trying to use ExternalInterface with; it does not work so great. The question is, where does the problem lie? My working externalInterface code looks like this:

import flash.external.ExternalInterface  
myBtn.onRelease = function(){  
chkAvail();  
}  

function chkAvail() {  
var myText:TextField = this.createTextField('myText', this.getNextHighestDepth(), 100, 100, 300, 21);  
ExternalInterface.call("alert",'EI works!!");  
myText.text = String(ExternalInterface.available);  
}

And all of that works great. My mp3 player code looks like this (excerpt, full code posted here): At the top-

import flash.external.ExternalInterface;

and where I want to call the javascript-

function loadPlaylist(){

//attempting to make external js call

ExternalInterface.call("alert", "Hello World!1");

//

track_display_mc.display_txt.text = LOADING_PLAYLIST_MSG;

if(track_display_mc.display_txt._width>track_display_mc.mask_mc._width){

    track_display_mc.onEnterFrame = scrollTitle;

}else{...

So why does the first one work and not the second one? I feel like I'm calling them correctly from the html. Could it be a problem with importing the flash.external.ExternalInterface? Should I include that in the .flv where the .as is imported/included, instead of in the actual actionscript? All help/ideas are greatly appreciated...

A: 

Is the mp3 player swf and the html on the same domain?

Did you set allowscriptaccess=always in your object + embed tags?

Geoff