dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: HELP PLEASE! AS3: disable buttons events with another button

  1. #1
    Junior Member
    Join Date
    Apr 2009
    Posts
    3

    HELP PLEASE! AS3: disable buttons events with another button

    Ok so I have been trying to get this all day and all I want to do is when I roll over a button it disable the main button that is in its way. I am making a header and it has a button that is lit up and shows a screen but when I roll over another button I want to disable that buttons mouse events. Here is what I have(be aware what I am trying to disable is a movie clip within the button so that is not part of action script)

    myButton.addEventListener(MouseEvent.CLICK, onMouseClick);
    function onMouseClick(event: MouseEvent):void
    {
    var request:URLRequest = new URLRequest("http://msn.com");
    navigateToURL(request, "_self");
    }

    myButton2.addEventListener(MouseEvent.ROLL_OVER, onRollOverHandler);
    function onRollOverHandler(event: MouseEvent):void
    {
    mybutton.mouseEnabled = false;
    myButton.buttonMode = false;
    }



    I'm just a Flash n00b that probably has a very simple problem to solve.

  2. #2
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    It is mybutton.enabled = false;
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  3. #3
    Junior Member
    Join Date
    Apr 2009
    Posts
    3
    Yea I figured that part out already, also the line below it needed to be deleted. The problem is it only disables the "over" and "down" but not the "up". I need the "up" to disappear when your mouse rolls over the new button.

  4. #4
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    What do you mean with up? Once the button is disabled it is disabled no matter which position the mouse is in.
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

  5. #5
    Junior Member
    Join Date
    Apr 2009
    Posts
    3
    Yes it is disabled but you can still see it, I want it to disappear entirely when I hover over the other button. This has been solved by someone on another forum already though, but there is still one more problem, now the button is not effected by the mouse and is not visible but I want it to regain all of this as soon as the mouse moves off of the other button, is there a toggle code for this? I only want these effects to happen while hovering over the other button.

  6. #6
    Mod cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,448
    Use visible = false. To get it visible again use
    myButton2.addEventListener(MouseEvent.ROLL_OUT, onRollOutHandler);
    function onRollOutHandler(event: MouseEvent):void
    {
    myButton.visible = true;
    }
    - The right of the People to create Flash movies shall not be infringed. -
    | www.Flashscript.biz | Flashscript Biz Classes/Components |

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