简体   繁体   中英

Actionscript and Javascript conversation

I am new to actionscript 3.0 and am using Adobe flash CS6. I need to pass the value of a javascript variable to my actionscript code embedded in my timeline (I am not programming in a seperate .as file but the timeline itself.). I need to compute a value using javascript, and then I need to use that value in my actionscript code. How can i do this?

My purpose is to return a String value using a javascript function and then display the same String in a text area in my flash movie. (test1.swf)

But i see nothing in the textarea....

I have attached the code as well as other details in a text file.. plz follow the link http://share-ideas.in/saurabh/App/test/code.txt

ExternalInterface maybe a bit tricky for beginners. There are quite a few conditions that need to be met for the communication to work:

  1. Either you test on a server, or add the location of the swf/html files as allowed in the Flash Player Security Settings
  2. The AllowScriptAccess is set to "always"
  3. The <object/> tag's name attribute should match the <embed/> tag's id. This should ensure js communcation across different browsers.

Depending on how confortable you are with coding, you can either try the ExternalInterface example and simplify/modify it for your needs or use SWFObject which should make it easier (and cleaner) to work with flash and js

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM