2

JavaScript and the Flash Player can exchange data via Flash's ExternalInterface mechanism: you register ActionScript functions that you would like to be able to be called from JavaScript.

My question: How can I figure out what ActionScript functions of a Flash object are available for me to call from JavaScript (assuming they are not documented)?

Is there a programatic way to do this in JavaScript?

Thanks!

Mark
  • 1,447
  • 2
  • 14
  • 26

1 Answers1

1

you can't enumerate them directly (they won't be listed in a for..in loop), but you can test for each one explicitly...

var swf = document.getElementById('theID');
alert('someMethod' in swf);  // will alert true if 'someMethod' is exposed via ExternalInterface.addCallback

this might fail if called during $(document).ready or window.onload - the swiff must be 'initialized' (loaded and registered) for the exposed methods to be available at all.

momo
  • 3,885
  • 4
  • 33
  • 54
  • But won't I still have to "guess" the right method names with that technique? I don't think that will do the trick. Thanks anyway! – Mark Dec 03 '10 at 18:44
  • you could always XMLHttpRequest a copy of the .swf, uncompress it with a javascript based zlib/gz/uncompress routine (they exist) and either search it for strings to test, or write a super simple parser, copy some source from here https://github.com/CyberShadow/RABCDAsm – Orwellophile Mar 12 '15 at 02:46