0

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

2
  • Here's a good tutorial on how to do this: viget.com/inspire/… Commented Jun 23, 2012 at 18:31
  • Basically you can use ExternalInterface to communicate between the two as is posted in the link above. If you're having troubles after checking out the article, edit your post with some code of what you're trying and how your project is setup in a little more detail. Commented Jun 23, 2012 at 20:52

1 Answer 1

0

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.