[thelist] Quick Question: Accessing the DOM with flash?

John Dowdell jdowdell at adobe.com
Fri Jul 20 17:28:01 CDT 2007

Jon Hughes wrote:
> Google didn't turn up anything, so I don't have my hopes up very high.

I've been finding it more difficult to locate resources on Google 
lately, myself.

> Just curious if it was possible to access the DOM using flash?

You're seeking to manipulate the HTML DOM, rather than the SWF file's 
object model, right?

If so, then most of the popular browsers support it these days... the 
key is the NPRuntime interface:

The Adobe Flash Player implements an "externalInterface" call, which 
uses the NPRuntime conventions in most browsers, and Microsoft's own 
ActiveX Scripting interface in their Windows browser:

JavaScript and ActionScript intercommunicate pretty well in Mozilla and 
Microsoft browsers these days, and I believe the Apple and Opera 
browsers offer at least some support in this area as well.

Development can be tricky, because you're working in two different logic 
engines simultaneously -- usually people handle it by high-level 
messaging on each side, rather than having one logic engine reach into 
the guts of the object model on the other -- more like sending a message 
"playButtonClicked()" from one to the other than "find video in DOM, 
check if loaded and not at end, and start playing" -- but you can 
definitely pass information back and forth between the two these days.


John Dowdell . Adobe Developer Support . San Francisco CA USA
Weblog: http://weblogs.macromedia.com/jd
Aggregator: http://weblogs.macromedia.com/mxna
Technotes: http://www.macromedia.com/support/
Spam killed my private email -- public record is best, thanks.

More information about the thelist mailing list