0

Does anyone know if I can pass data from flash (action script) to java script? If yes... how?

(I need to send an ajax request with a text typed inside a textbox from actionscript).

1 Answer 1

1

You can use ExternalInterface to interact w/ JavaScript

import flash.external.ExternalInterface;
button_1.addEventListener(MouseEvent.CLICK, function(){ 
      ExternalInterface.call("myFunc", "param");
});

for some reason i run into issues if i declare JavaScript tag type='text/javascript'. so i recommend using:

<script language='javascript'>
function myFunc(myparam){
      //your code
}
</script>
Sign up to request clarification or add additional context in comments.

2 Comments

That will probably work, but I believe the official way to use it is ExternalInterface.call("myFunc", "param") - help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/…
+1 @Lars yes sir, you are correct. will make changes in my own code and on here =D thanks. do u know why it won't work when i use <script type='text/javascript'></script> ?

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.