JavaScript Communication
I was reading about Flex- JavaScript communication via ExternalInterface.
But I had a doubt, it said that the javascript code should be written in the HTML file of the application ?
Now which is this HTML file ?
Is it th开发者_开发百科e index.template.html
file per project or the HTML file created per MXML application
?
You should better use the index.template.html
, since this is the file used as a template for the HTMLs generated for each MXML application. Otherwise a simple clean on the project might delete the code you've added to the HTML file created per MXML application.
Yes, or if it's a lot of javascript, you could externalize it by including a script tag in the index.template.html file. The index.template.html file is used to generate the index.html files in bin-debug and bin-release folders.
this pages describe external interface very well. Most important thing to not forget is
<param name="allowScriptAccess" value="sameDomain" />
And for better flash embeding, use http://code.google.com/p/swfobject/ .
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/external/ExternalInterface.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6
精彩评论