Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Debugging a MOUSE_DOWN function

Explorer ,
Sep 03, 2013 Sep 03, 2013

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;

}

TOPICS
ActionScript
408
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 03, 2013 Sep 03, 2013
LATEST

use the trace function to debug.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines