;

PDA

Click to See Complete Forum and Search --> : Trying to do something simple...


Elliot123
09-05-2007, 01:33 PM
Hey guys,

I am relatively new at flash cs3 & action script, and as you would imagine I am hitting a big roadblock in trying to make a clickable banner. I can get the animation down just fine, but when it comes to getting some of my invisible buttons to work, I am out of answers... But I'm sure the answer is something I am just not seeing.

OK heres the problem...

I am trying to make a banner that fades in and out text (links)... The text in the first layer fades out and the text in the second layer fades in. The text on both layers is occupying the same spot. Simple animation. Now the problem occurs when i try to add invisible linkable buttons to both layers... What winds up happening is that the first layer fading in no longer is clickable, but second layer works fine (everything clicks and links fine.) If I delete the second layer fade, then my buttons on the first layer start working again. Any ideas?

here is the AS I am using for my buttons:

Layer1:

butt1.addEventListener(MouseEvent.CLICK, buttonClickHandler1);
function buttonClickHandler1(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.google.com/"));

}

Layer2:

butt2.addEventListener(MouseEvent.CLICK, buttonClickHandler2);
function buttonClickHandler2(event:MouseEvent):void {
navigateToURL(new URLRequest("http://www.yahoo.com/"));

}

Please, any help would be well appreciated!

illustratedlife
09-05-2007, 02:21 PM
When you have two objects on top of one another, the front one always receives the MouseEvents. If you need to click the link behind, use the mouseEnabled property.

butt2.mouseEnabled = false;

For the purposes of clicking, butt2 is completely invisible after you issue that command. Reenable it as follows:

butt2.mouseEnabled = true;