Skip to main content
Participant
September 3, 2013
質問

Debugging a MOUSE_DOWN function

  • September 3, 2013
  • 返信数 1.
  • 418 ビュー

I have an animation im working on, a series of images, placed in individual keyframes, that is rotatable by clicking down and dragging left or right.

My actionscript is solid when viewed in flash's desktop player. The problem is the client views it in whatever web browser he uses, and when viewed in a web browser, the MOUSE_DOWN action causes the image to progress without regard to the mouseX rule.

This is making me pull my hair out, so here is my code, any help would be appreciated:

stop();

stage.addEventListener(MouseEvent.MOUSE_DOWN, mDown);

stage.addEventListener(MouseEvent.MOUSE_UP, mUp);

var prevMouseX:int;

function mDown(event:MouseEvent):void {

prevMouseX = stage.mouseX;

    this.addEventListener(Event.ENTER_FRAME,mMove);

}

function mUp(event:MouseEvent):void {

    this.removeEventListener(Event.ENTER_FRAME,mMove);

}

function mMove(event:Event):void {

               

        var activeMouseX = stage.mouseX;

      

        if (activeMouseX > prevMouseX){

            if(currentFrame == 1){

                gotoAndStop(totalFrames);

            } else {

                prevFrame()

            }

        }

        if (activeMouseX < prevMouseX){

            if(currentFrame == totalFrames) {

                gotoAndStop(1);

            } else {

                nextFrame()

            }

        }

prevMouseX = stage.mouseX;

}

このトピックへの返信は締め切られました。

返信数 1

kglad
Community Expert
Community Expert
September 4, 2013

use the trace function to debug.