简体   繁体   中英

call javascript from flash as3 which is hosted by a different domain

there is a javascript function running on sub.website.com and a flash component hosted in website.com. I add flash object to sub.website.com using object and embed tag and in some point im expecting to see result of a javascript function which is fired by flash object. but i think it doesnt allow me to do that due to the cross-domain thing.

I have no control on a.website.com because its a cname defination to another website (i cant upload a file but i can add extra javascript function).

is there any solution for that?

I think you while have to work with an Ajax call from sub.website.com to a.website.com . This ajax call can be wrapped in the javascript on sub.website.com that can be called within a SWF by the ExternalInterface.

So SWF on 'sub' server called a Javascript function on the 'sub' server which fires a Ajax call to server 'a' and this server gives some data (JSON for example) back to the Javascript of server 'sub'. So the Javascript of server 'sub' can return the data to the SWF by the ExternalInterface.

See the adobe site for documentation about External Interface:

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM