views:

75

answers:

3

Suppose I have a flash application; let's say a chess game. The user is playing against a computer opponent. After every move, I want the flash application to add the move's "description" into the HTML of the page.

Does flash have this ability?

Are there any common round-about ways of doing this? Maybe the flash app updates a database, and some AJAX on the page frequently checks the database and adds content when appropriate.

Are there any examples on the web of this type of functionality?

+3  A: 

From ActionScript, you can use ExternalInterface to call Javascript functions in the client browser, so yes, this is possible.

Paul Dixon
+1  A: 

I see in my ActionScript 3.0 Bible, chapter 36 "Interfacing with JavaScript" that you can use flash.external.ExternalInterface to "both call JavaScript functions from Flash and to call ActionScript functions from JavaScript".

Therefore, you can change any DOM element from a JavaScript that you activate from Flash.

gdelfino
+1  A: 

Your ActionScript code can access javascript methods that update the page's DOM.

You can access Javascript methods using the ExternalInterface class. more details at: http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html

Saggi Malachi