This content has been marked as final. Show 7 replies
is listenInLibraryPlayer.swf the name of your embedded swf? and where's str coming from?
That is the name of the .swf.
I have a new version which uses links instead of a form (and also fails, but is closer to what I eventually want)...
<a name="text_link" id="text_link" onclick='callExternalInterface("1");' >Click Here for 1</a>
<a name="text_link" id="text_link" onclick='callExternalInterface("2");' >Click Here for 2</a>
Then if that's not working I would check that your generated id and name tags are as follows:
your object tag id atttribute is "listenInLibraryPlayer" and the embed tag name attritbute is also "listenInLibraryPlayer"
If you're using a script (like swfobject or adobe's activecontent.js etc) then you need to make sure you have it set up to generate the correct embedding output to give the correct id and name attributes
Thanks to all for replying, but I'm still not getting this thing to work (argh!).
As far as I can tell, the name and id are correct everywhere, and I have no idea what's wrong. If anyone is feeling really generous, the files are all located in a zip here - maybe someone can figure out what I'm missing...
There's three problems I see.
2. I don't think "1" or "2" work as arguments. I used an argument the same as your internal buttons to get it to work, e.g.
callExternalInterface('Storage 2'); or callExternalInterface('Storage 1');
2. You have multiple object/embed tags with the same id/name pairs, which prevents the reference for the external call working properly. I got it working in firefox by stripping it down to just one embed tag. The noscript wrapped embedding code seems to interfere with this as well.
The way I would approach it is this: use swfobject to do the embedding and a ) remove the noscript tags if the player version is >= 8. Then use the write method of the swfobject instance to write the embedding code to a div target. swfobject only ever inserts the appropriate embedding code for the browser its being used in so you don't get duplicate ids.
If I get time tomorrow and you haven't managed to get it working I'll provide a working example... but those three things make it work.
You're welcome. There may be some browser differences with the handling of id tags etc. I didn't try it in IE or safari. Its not the version detection code or embedding code that kills it... it seems to be the resulting embedded code. If you have 2 or more tags with the same id attribute then ExternalInterface doesn't (shouldn't?) work correctly. But if it still works in safari then I guess that doesn't hold true for all browsers.