A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Trying to do something simple...

  1. #1
    Junior Member
    Join Date
    Sep 2007
    Posts
    1

    Question Trying to do something simple...

    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!

  2. #2
    Multitouch Aficionado
    Join Date
    Mar 2006
    Posts
    275
    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;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center