Passing javascript function and named anchor using getURL (show hide div from flash)

Hi all,

I have been really scratching my head over this one for quite some time so any help, suggestions would be more than welcome.

what I am trying to achieve:

The user loads a video inside a div (display:none;) from a flash navigation.

the javascript i am currently using to show/hide the div works fine from html buttons and hyper links in all browsers except firefox!

<script type="text/javascript">
function playVideo(sourceId, targetId) {
   if (typeof(sourceId)=='string') {sourceId=document.getElementById(sourceId);}
   if (typeof(targetId)=='string') {targetId=document.getElementById(targetId);}
   return false;

The flash navigation also needs to trigger a named anchor and for this i am using getURL:

on (press) {
on (release) {


firefox and safari will not show the div from the code passed through flash! ie is as yet untested. Chrome seems to work well with the whole thing (including the jump to div using named anchor) and sunrise has varying success (if you click the button 20 times one of them will work!).

Summary -

I want to show hide div from flash and activate a named anchor…how is this done!??

current working example:

Thanks for reading, hope to have some answers soon,

I stumbled on to the external interfaces idea just before receiving the email of your reply… how strange the Internet is, at least it seems to work!

This definitely made calling the java to show hide the div much smoother in all browsers, in fact it works great.

However, there was still the named anchor problem. It works first but not the second for a lot of browsers.

But fear not, I now do have it working with javascript scroll function instead of named anchor. I dont know why i didn’t think of it before, it is really simple when you think about it.

So for those of you wanting to do something similar:

  1. Put the javascript functions to be called from flash in the html head and NOT on a linked js file.

  2. put action script on the button to call the function:

on (release) {
import flash.external.ExternalInterface;"function('variable','variable')");
  1. Use a scroll javascript command to move down via pixels instead of the named anchor

<!-- scroll js -->
<script language="JavaScript">
function scroll(){
<!-- end scroll js -->

4) call this from flash also with the actionscript:

import flash.external.ExternalInterface;

on (release) {“scroll()”);

Use externalInterface to call the javascript