Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

swf : calling functions declared via ExternalInterface.addCallback fails #846

Closed
ghost opened this Issue Apr 5, 2014 · 1 comment

Comments

Projects
None yet
1 participant
@ghost
Copy link

ghost commented Apr 5, 2014

There are two points of failure here :
1 ) the id of the SWF object element is currently set to 'fancybox-swf' which contains one of the proscribed characters according to Adobe documentation : http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html
excerpt : "Note: When embedding SWF files within an HTML page, make sure that the id attribute is set and the id and name attributes of the object and embed tags do not include the following characters: . - + * / "

2 ) in some browsers you must get a reference to the object element and in others you must get a reference to the embed element in order to call the ActionScript function ('callback') from JavaScript. The embed element is not currently given an id at all.

I see three levels of solution :
1 ) Fix the '-' in the id of object and add a different id to embed in order to facilitate a 'roll-your-own' solution

2 ) Add an API that returns a reference to the Flash Player by function name : like getFlashPlayerForFunctionCall( functionName )

3 ) Full boat solution 'callActionScriptFunction( functionName, paramArray ) and then use 'apply' to call the function and passthrough/return the result

I documented my workaround on Stack Overflow : http://stackoverflow.com/questions/22875712/externalinterface-callback-not-working-in-fancybox

@fancyapps

This comment has been minimized.

Copy link
Owner

fancyapps commented Feb 27, 2017

Hi, thanks for your work.

@fancyapps fancyapps closed this Feb 27, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.