How To Interact With Flash Via Javascript?
Solution 1:
http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html
The ExternalInterface class is designed specifically for this purpose. It's a relatively simple class for exposing actionscript functions to JS or vice versa. I recently implemented it in an audio player my team developed to have an HTML formatted tracklist trigger play and stop events.
Essentially, you can make your code first check against ExternalInterface.available
to make sure the container has an external interface (IE in a browser window with javascript and not just running from flash player.) From there, you can use addCallback
to designate a function that can then be called on the flash applet's container.
You can then call it using the typical javascript - just access the method off of the container using getElementByID or whatever selector flavor you prefer if you're using a framework.
Make sure your embed method allows script access to the flash applet as well.
Post a Comment for "How To Interact With Flash Via Javascript?"