Reputation: 64526
I have a Facebook Canvas iframe app. In that, I have a SWF object which needs to call a javascript function which is defined in my main facbebook app body. The call is not being made, I'm guessing Facebook are stopping it.
There must be a way around this?
I am doing a test call like this from Flash (AS2):
getURL("javascript:alert(1);");
Do I need to try and capture the facebook iframe and use that in Flash?
Upvotes: 0
Views: 774
Reputation: 64526
I knew there was a way around this. Put the flash in a HTML document and set document.domain = x
. In the body of the Canvas app, also set the same document.domain = x
. Then use an iframe to show the flash's HTML document.
The flash then can make javascript calls and interact with your canvas app as needed.
Upvotes: 0
Reputation: 4371
you need to use ExternalInterface class:
ExternalInterface Documentation
it's easy as ABC. for example this line of code will execute
the alert javascript function.
ExternalInterface.call("javascript:alert();");
Upvotes: 1
Reputation: 825
Have you tried ExternalInterface class? http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/2/help.html?content=00001036.html
Upvotes: 0