5

Wondering if its possible to communication from javascript to flash without the use of SWFobject or any other extra javascript file.

Currently I am using the following guide: http://www.viget.com/inspire/bi-directional-actionscript-javascript-communication

Thank you for your time.

ajm
  • 19,795
  • 3
  • 32
  • 37
Alec Smart
  • 94,115
  • 39
  • 120
  • 184
  • Why the down vote? Am I missing something for this seems like a good question. – Bobby Cannon Jun 24 '09 at 15:08
  • Yeah, no clue why it got down voted. Seemed a good question to me, too. – ajm Jun 24 '09 at 15:23
  • Just wanted to mention that you don't need to use the complicated (and deprecated) getFlashMovie code in that viget link -- you can simply use document.getElementById. It's supported by all modern browsers including IE6. I use it all the time for ExternalInterface and it works just fine, plus it's forward-compatible and standards-based. – pipwerks Jun 25 '09 at 05:54

1 Answers1

3

It's perfectly possible using Flash's externalInterface and the JavaScript you're writing yourself alone (which should be the only JavaScript you'll need).

SWFObject exists only to abstract away adding Flash pieces to HTML content, so it's not necessary at all (it's basically going to write the proper object and embed tags depending on your browser and work around the IEs' ActiveX click-to-run-Flash warnings).

If you wanted to hand-code your Flash piece into a document, that's perfectly fine; SWFObject makes it cleaner and easier but doesn't enable or add functionality beyond that. However, because it works so well, it's become kind of a standard method to get Flash on a site.

Drop your Flash piece on a page however you'd like, make sure it has an id set in its object and embed tags and you should be set.

ajm
  • 19,795
  • 3
  • 32
  • 37