Pass data from action script to javascript

家住魔仙堡 提交于 2020-01-03 05:05:23

问题


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:


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>


来源:https://stackoverflow.com/questions/5017970/pass-data-from-action-script-to-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!