问题
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