as3 calling jQuery function

我们两清 提交于 2019-12-13 04:16:23

问题


I need flash to talk to jQuery.

Here is my Flash code:

if (ExternalInterface.available) 
{
 ExternalInterface.call('function(){ MyFunction(); }');
ExternalInterface.call('function(){ alert("Praise Be Jesus Christ!"); }');
}

The "Alert" works great. My function does not.

Here is my jQuery:

<script type="text/javascript">

  $(document).ready(function()
  { 
  $("#flashContentABOVE").click(MyFunction);



  function MyFunction()
  {
            $("#flashContentABOVE").css("z-index", 4 );

  }

  });
</script>

回答1:


Put your <script> tag at the bottom of your html file (before the closing <body>), and take out the document.ready() function.




回答2:


You should be able to call MyFunction directly from your swf. I always call ExternalInterface like:

ExternalInterface.call("funcName","param1","param2");


来源:https://stackoverflow.com/questions/10923705/as3-calling-jquery-function

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