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
Here is the AS3:
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:
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:
<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”