# Flash + Javascript + CSS = I've created a monster!

**URL:** <https://forum.kirupa.com/t/flash-javascript-css-ive-created-a-monster/258764>\
**Category:** Uncategorized\
**Created:** [April 28, 2008, 2:05am UTC](https://forum.kirupa.com/t/flash-javascript-css-ive-created-a-monster/258764 "2008-04-28T02:05:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![freshrod](https://avatars.discourse-cdn.com/v4/letter/f/43a26b/32.png) [@freshrod](https://forum.kirupa.com/u/freshrod)\
**Post date:** [April 28, 2008, 2:05am UTC](https://forum.kirupa.com/t/flash-javascript-css-ive-created-a-monster/258764/1 "2008-04-28T02:05:45Z")

</div>

Greetings

Ok, I had this problem with getting my flash buttons to activate a javascript to change the content of a DIV with a show/hide. I got some help. The weird thing is that the guy who was helping me says it works. I can’t tell because it doesn’t and has errors for me.  
He was viewing with: Firefox 2 windows xp, flashplayer 9.0.115  
I was viewing with: IE 7 vista home premium CS3 installed  
Why?

Here is the [site](http://www.freshrod.com/final/freshrod.html)

Here is the AS3:

```auto
import flash.external.ExternalInterface;
info_btn.addEventListener(MouseEvent.MOUSE_DOWN, movClick);
function movClick(event:MouseEvent = null):void{
  if (ExternalInterface.available){
    ExternalInterface.call("switchContent", "content2");
  }
}

```

Here is the javascript:

```auto
function switchContent(obj) {
  obj = (!obj) ? 'content1' : obj;
  var contentDivs = document.getElementById('center').getElementsByTagName('div');
  for (i=0; i<contentDivs.length; i++) {
   if (contentDivs*.id && contentDivs*.id.indexOf('content') != -1) {
    contentDivs*.className = 'hide';
   }
  }
  document.getElementById(obj).className = '';
 
 }

```

And here is the html:

```auto
<div id="center">
   <!--start content1 - home -->
    <div id="content1">
      Content for id "content1" Goes Here </div>
      <!--end content1 - home -->
      <!--start content2 - info -->
    <div id="content2" class="hide">
    Content for id "content2" Goes Here </div>
      <!--end content2 - info -->
      <!--start content3 - work -->
    <div id="content3" class="hide">Content for id "content3" Goes Here</div>
      <!--end content3 - work -->
      <!--start content4 - contact -->
    <div id="content4" class="hide">Content for id "content4" Goes Here</div>
      <!--end content4 - contact -->  
    <!--start bottom -->
    <div id="bottom"></div>
      <!--end bottom -->
  </div>
  <!--end content -->

```

Please answer before my face is rendered unrecognizable from untold faceplants to the keyboard. Thank you.

p.s. I have only added the AS to the button labeled “info”
