0

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
  • 1
    Try placing it outside the ready function. Commented Jun 6, 2012 at 23:29

2 Answers 2

1

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

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

3 Comments

Awesome! That's it! I can't even click "That's correct" yet since you answered so fast. Thank you. I will check it soon. Are you sure removing the document.ready() function won't give me issues elsewhere? What is the purpose of it?
document.ready() catches an event that's fired when the DOM is loaded and ready to be manipulated. Since we've put the script tag at the bottom of the page, we already know for sure that the browser has loaded the elements above.
Any idea how to call an actionscript 3 function from jQuery?
0

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

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

1 Comment

Any idea how to call an actionscript 3 function from jQuery?

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.