Hi all,

Posted this issue in the HTML forum, but i think it is better suited here. I'm trying to get buttons in a flash animation to show/hide layers in a HTML document.

I've figured out a way to get this working using show/hide DIV layers and 'ExternalInterface' in flash. Unfortunately it's only half working.

Have a look at www.it-world.com.au and click on the 'Our Services' link in the flash banner. That should work ok, hiding the main layer and showing the services layer. But then try 'Our Products' and 'Contact us' and the layer that gets changed is the News layer. I have no idea why! When I hide the news layer in comments, then these two open in new tabs.

The Flash code is:

Code:
import gs.TweenLite;
import gs.easing.*;
import flash.external.ExternalInterface;

btnGroup.addEventListener(MouseEvent.CLICK, btnClick);
btnGroup.buttonMode = true;

var btnName:String = "";

function btnClick(event:MouseEvent):void
{
	btnName = event.target.name;
	switch (btnName)
	{
		case "btn1" :
			TweenLite.to(container_mc, .5, {y:216});
			break;
		case "btn2" :
			TweenLite.to(container_mc, .5, {y:0});
			break;
		case "btn3" :
			TweenLite.to(container_mc, .5, {y:-216});
			break;
		case "btn4" :
			TweenLite.to(container_mc, .5, {y:-1200});
			break;
		case "btn5" :
			TweenLite.to(container_mc, .5, {y:-1600});
			break;
	}
}

this.btnGroup.btn1.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandler);
function mouseDownHandler(event:MouseEvent):void {
    ExternalInterface.call("hideDiv", "text");
    ExternalInterface.call("hideDiv", "products1");
    ExternalInterface.call("hideDiv", "contact1");
	ExternalInterface.call("showDiv", "services1");
}

this.btnGroup.btn2.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandler2);
function mouseDownHandler2(event:MouseEvent):void {
    ExternalInterface.call("hideDiv", "text");
	ExternalInterface.call("hideDiv", "services1");
	ExternalInterface.call("hideDiv", "contact1");
	ExternalInterface.call("showDiv", "products1");
}

this.btnGroup.btn3.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandler3);
function mouseDownHandler3(event:MouseEvent):void {
    ExternalInterface.call("hideDiv", "text");
    ExternalInterface.call("hideDiv", "services1");
    ExternalInterface.call("hideDiv", "products1");
	ExternalInterface.call("showDiv", "contact1");
...which to me looks like it should work... and it does, but only for the first button! I suppose the other two buttons do work- just incorrectly!

I'm not versed at all in actionscript/javascript and have found this code through tutorials etc, but just can't get it to implement on this site.

Any thoughts? I don't know if it is the HTML, Flash or Javascript!?

Regards,
Ross