lundi 21 décembre 2015

How to have different mouse cursor on MOUSE_DOWN in as3?

I'm new to as3 and I need to do a very simple thing. I have following code and it works pretty well. But what I need and can't figure out how to do it is:

  1. change mouse cursor when I hold mouse button (choose from symbols)
  2. ability to move with it (normally it would disappear when I move with mouse)

        import flash.display.Sprite;
        import fl.motion.MotionEvent;
        var CursorStill: Sprite;
        var CursorAnim: Sprite;
        function init() {
          CursorStill = new CursorStillClass();
          CursorStill.mouseEnabled = false;
          CursorStill.visible = false;
          stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
          stage.addEventListener(Event.MOUSE_LEAVE, mouseLeaveHandler);
          stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
        function mouseMoveHandler(evt: MouseEvent): void {
          CursorStill.visible = true;
          CursorStill.x = evt.stageX;
          CursorStill.y = evt.stageY;
        function mouseLeaveHandler(evt: Event): void {
          CursorStill.visible = false;
        function mouseDownHandler (evt: MouseEvent): void {
          CursorStill.visible = false;

Aucun commentaire:

Enregistrer un commentaire