0 Replies Latest reply on Nov 2, 2007 10:09 AM by Sly Raskal

    AS3 and ability to handle dragout events

    Sly Raskal Level 1
      I'm making the switch to AS3 and am working on a new flash game for work that will be written in AS3.

      I'm adding the event handling to some buttons but am running across some issues.

      since the onDragOut event has been replaced with the generic MOUSE_OUT event, how do you guys suggest handling instances where the user presses a button, roll out of the button and doesn't release the mouse, and then roll back over the button?

      Here is the code I am using to create the event handling for buttons:

      btn_path.buttonMode = true;

      rollOverHandler = function() {
      btn_path.gotoAndStop('over');
      }

      rollOutHandler = function() {
      btn_path.gotoAndStop('out');
      }

      mouseDownHandler = function() {
      btn_path.gotoAndStop('down');
      }

      mouseUpHandler = function() {
      btn_path.gotoAndStop('over');
      }

      btn_path.addEventListener(MouseEvent.MOUSE_OVER,rollOverHandler);
      btn_path.addEventListener(MouseEvent.MOUSE_OUT,rollOutHandler);
      btn_path.addEventListener(MouseEvent.MOUSE_DOWN,mouseDownHandler);
      btn_path.addEventListener(MouseEvent.MOUSE_UP,mouseUpHandler);


      Do you guys know of any other solution or workaround because as the code currently is, if a user rolls out after pressing the button (not releasing), when they roll back over, they go to the over state instead of the down state.

      I've tried adding flags to know when a button was pressed, etc.; however that gets ugly and problematic.

      I'd like to know how you guys implement your buttons events and what you do for the events.

      I'm currently using movieclips for my buttons.