A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Canceling MouseEvent.ROLL_OUT on CLICK

  1. #1
    Junior Member
    Join Date
    Jun 2011

    Canceling MouseEvent.ROLL_OUT on CLICK

    I am using an event listener for both rollOut and rollOver to a button, on roll over it populates a text field, roll out clears the field, however I would like on click to populate the field and leave it persistant untill another roll over event happens, curently the roll_out event takes priority and when I move my mouse it clears the field, regardless of click.

    what is the best way to cancel the roll_out event?

  2. #2
    Flactionscrish Baby Minion's Avatar
    Join Date
    Nov 2005
    Planet Earth
    simply remove the event listener for roll out once clicked.
    add it back when roll over

    somethign like this: ?

    Actionscript Code:
    button.addEventListener (MouseEvent.ROLL_OVER, onMouseRollOver);

    function onMouseRollOver (e:MouseEvent):void {
        button.addEventListener (MouseEvent.ROLL_OUT, onMouseRollOut);
        button.addEventListener (MouseEvent.CLICK, onMouseClick);
        textfield.text = "the awesome text";

    function onMouseClick (e:MouseEvent):void {
        button.removeEventListener (MouseEvent.ROLL_OUT, onMouseRollOut);

    function onMouseRollOut (e:MouseEvent):void {
        textfield.text = "";
    he who hesitates is lost; so i guess i'll wander intently

    Are you sure this is real?
    Life is Love, Love is Blind, Blind we go through Life.
    Life isn't hard, dealing with your self is.

    The concept of life in a human brain is weakening day after day. Live every day like its your last. Take the chances, and opportunities, and never let authority push you around for fun.

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