0

I'm trying to show a div when someone clicks on the flash button pertaining to certain div. This is the javascript function I'm trying to have called:

<script type="text/javascript">
    function show1() {
        document.getElementById(#table1).style.display = 'block';
    }
</script>

"#table1" is the Div ID that I'm trying to display after the person clicks a button in flash. I haven't used flash in forever and am struggling finding the answer; it used to be you could just call it by going the getURL route, but that doesn't work any longer. Does anyone know how I would call that function to show the div?

Thanks in advance.

1

2 Answers 2

1

You want to use ExternalInterface. Inside of flash just write ExternalInterface.call("show1");

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

Comments

0

Update AS 3.0 Using ExternalInterface:

for some reason JavaScript doesn't work when tagged <script type="text/javascript"></script>. So, change your html part.

HTML:

<script language='javascript'>
function show1(){
      document.getElementById('table1').style.display = 'block';
}
</script>

Actionscript 3.0:

import flash.external.ExternalInterface;
button_1.addEventListener(MouseEvent.CLICK, function(){ 
     ExternalInterface.call("show1", "param");
});

Make sure in the html 'allowScriptAccess' is set to 'always' in AC_FL_RUnContent, object param, and embed.

4 Comments

I could do this, but when I publish the movie, it debugs and completely screws everything up from the getURL function. Is there a way to allow it within the movie itself?
which version of actionscript are you using, and when you say screws up from the getURL func what do u mean?
Here's the code I have tried... button_17.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler_2); function fl_MouseClickHandler_2(event:MouseEvent):void { getURL("javascript:show1();"); }
I also tried the external interface code, but I can't get that to work either. I'm at a complete loss.

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.