How to detect the direction of the mouse and change of scenery?

Hello

I'm building a single 360 degree rotation effect using individual images and buttons front and back . I am new to AS3 and have managed to create functioning buttons... (so my code can be a little weird!)

But now, I would also like to advance frames by clicking and dragging on the image itself (or on an invisible button sitting on top of the image).

Although there are some threads here that have asked the same thing, I don't understand how they were answered. My code is below, and the file with that I'm practicing is located on:

https://download.yousendit.com/MVNjeFlWSWh6NE4zZUE9PQ

Currently if you click on the area of the image, it will move forward, but there is no code to detect the direction of the mouse, he'll just before. Can someone help me understand how to set up a simple direction detection and then use it to decide whether to move forward or backward... Thank you!!

Stop();

move forward 1 frame on click

function forward(e:MouseEvent):void {}

If (currentFrame == 15) {}

gotoAndStop (1);

{ } else {}

gotoAndStop (currentFrame + 1);

}

}

go back 1 frame during the click on

function back(e:MouseEvent):void {}

If (currentFrame == 1) {}

gotoAndStop (15);

{ } else {}

Stop (currentFrame - 1);

}

}

btn_fwd.addEventListener (MouseEvent.CLICK, forward);

btn_bck.addEventListener (MouseEvent.CLICK, return);

change frame on direction of mouse?

function MouseMove(event:MouseEvent):void {}

{

if(event.buttonDown==true)

If (currentFrame == 15) { }

gotoAndStop (1);

}else{

gotoAndStop(currentFrame + 1);

}

}

}


stage_btn.addEventListener (MouseEvent.MOUSE_MOVE, MouseMove);

Here's an almost identical thread, I answered: http://forums.adobe.com/thread/570903?tstart=0

Tags: Adobe Animate

Similar Questions

  • How to detect the left and right navigation

    Hello

    I would like to know how to follow the movenemt left and right of the trackball. I know that it is possible to follow up and down.

    Thanks in advance

    working on 4.6.1 JDE

    On a screen (FullScreen/screen), you can do something like this...

        // The navigationMovement method is called by the event handler when the trackball is used.
        protected boolean navigationMovement(int dx, int dy, int status, int time)
        {
            // Add (x velocity) based on trackball movement
            int incVelX = 0;
    
            if (dx != 0) {
                if (dx < 0) incVelX--;
                else incVelX++;
            }
            return true;
        }
    
  • How to detect the duplex and the current speed of the Ethernet card?

    Hi, is there a tool to measure the current Ethernet card speed and duplex? I remember we had one for XP, but it does not work on Win7.

    Any thoughts?

    Specifically, I need to make sure my router and my NIC to work together without duplex mismatch.

    Thank you

    You will never see these actual speeds anyway. They are all theoretical maximum speeds. The only way to find your actual speed is a test of speed through your Internet access provider. Frenchie

  • How to detect the window closing event and to do some tasks before leaving

    Hello

    Someone knows how to detect the window closing event and to do some tasks before leaving?

    Sridhar

    Structure of the event allows to detect the window closing event. In the structure of the event,.

    Select this VI-> close round table for this task. See attached picture.

  • How to detect the sign of a number?

    I output which gives the number of negative or positive. My problem is how to detect the sign of the Boolean number and output? For example if the input number is negative as - 23.11 I want to output the value false and if the number is positive as 17.99 I want to output true.

    T H A N K S!

    Test if the number is greater than or equal zero.

  • How to detect the cFP-1804

    Hello

    I have a cFP1804 connected to a cFP2120 via EThernet.  The cFP1804 has a thermocouple installed package that is read once per second the 2120 by using the 'FP Read.vi"(see file attachment). When systems are interconnected, the correct values of returns «FP read» When disconnecting from the cFP1804, "PS read" still will continue to serve the received values but triggers error 33800 until the connection has been restored. So far so good.

    The problem I have happens when you reset the cFP2120 while the cFP1804 is offline. At that time a single "FP read.vi' will cause the program running on the cFP2120 to stall completely.

    No idea how to get around this problem?

    I'm using Labview 8.2.1 with RT version 5.0.1

    Thank you

    V

    Hi Volker,

    You can detect the RT and network objectives using the replication VI system. An explanation can be found in NI Developer Zone tutorial: replication of system of target in real time at http://zone.ni.com/devzone/cda/tut/p/id/3937. The download link is at the bottom of the page. Be sure to read the included Readme for installation instructions. If you run the VI find all targets, you will be able to test if the cFP-1804 is on the network.

  • How to detect the stop scrolling

    Hi all

    I am currently working with the Bold and Storm, JDE 4.6.0 and JDE 4.7.0 respectively. I have the following question: How can I detect when the user stop scrolling? I have set up a ScrollChangeListener.scrollChanged () that detects when the user begins to scroll through the screen. At the moment, I put a Boolean variable in the true, but now I need to put the same variable to false when the user stops scrolling and I don't know how to do it. Any idea?

    Is there another listener or event that it would be useful for detecting the start and stop scrolling or the movement on my screen?

    Thanks in advance for your reply,

    Gabriela.

    Try to implement a TimerTask with Timer class to check the status of scroll each time.

  • How to detect the key ALT pressed in os7

    Hai,

    How to detect the key ALT pressed in Os7...

    Can I use the source for os 7 as below? ,

    protected boolean keyStatus (int keycode final, time final int) {}

    If (Keypad.key (keycode) == Keypad.KEY_ALT) {}

    ...

    Returns true;

    } else

    Return super.keyStatus (keycode, time);

    }

    and also I want to know which is the return of this method? In detail
    How to detect the other touches also?
    What are the updations or changes in the code, on os6 os7?

    KeyCode is a bit model, if you use "is" to compare you won't get accurate results, you should use the operator '& '.

    See
    http://supportforums.BlackBerry.com/T5/Java-development/detect-ALT-and-shift-key-clicks/Ta-p/444976

  • How to disable the mouse

    How to disable the mouse

    Hi Melvin,.

    Try this: go to control panel, click on Device Manager, when it opens, click the mouse or the other, or if this is not present, HID (Human Interface Device). When you find the mouse in question, right-click it and then click on disable.

    Let me know if this solves the problem for you or if you need more specific help, do something.

    Kind regards

    BearPup

  • How to move the mouse position of puppetry, followed by position in photoshop?

    How to move the mouse position of puppetry, followed by position in photoshop?

    In Photoshop, handles (guides) are creating/editing mode shape with the pen tool. Select the layer with mousetrack in his name, and then in the pen tool, you should see a small "x" indicating the location of the handful of mousetrack. Press and hold the appropriate keyboard qualifier (for example, Ctrl on Windows) to select the 'x' and then drag it to the intended location.

  • How to detect the number of created quickobjects

    How to detect the number of quickobjects created? quickobject are quickbox2d.

    Basically, I have a timer that will countdown to 4 seconds and it will create a falling ball, it will get removed when she falls down. However, I want only there so that if more than 5 bullets are in step, it will cease to create until it is less than 5 to start creating some balls again. Is there a way I can do?

    It's the timer to create the ball

    If (! _ballCreation_timer) {}

    _ballCreation_timer = new timer (4000);

    _ballCreation_timer.addEventListener (TimerEvent.TIMER, _onBallCreationTimer);

    }

    _ballCreation_timer. Start();

    Function which create the ball based on clock

    function _onBallCreationTimer (e:TimerEvent): void {}

    _doCreateNewBall();

    }

    function _doCreateNewBall() {}

    _ball_quickobject = sim.addCircle ({x: PHYSICS_SCALE * (960), y: PHYSICS_SCALE * (10), RADIUS: 0.5, draggable: false});

    MAKE A LIST OF BALLS

    _balls_array.push (_ball_quickobject);

    }

    This is the part where if the table (QuickObject) ball falls down and are destroyed

    addEventListener (Event.ENTER_FRAME, _onEnterFrame);

    DRAW EACH BALL FALLING OUT OF THE SCREEN

    function _onEnterFrame (aEvent: Event): void {}

    for each (var quickObject: QuickObject in _balls_array) {}

    BALL FALLING OUT OF THE SCREEN?

    If (quickObject.y / PHYSICS_SCALE > 1080) {}

    _doHandleBallOffScreen (quickObject);

    }

    }

    }

    DESTROY THE BALL FALL OFF THE SCREEN IF

    function _doHandleBallOffScreen (aQuickObject: QuickObject): void {}

    DESTROY THE OBJECT

    aQuickObject.destroy ();

    REMOVE FROM THE CUSTOM TABLE

    _balls_array.splice (_balls_array.indexOf (aQuickObject), 1);

    }

    check the length of _balls_array.  If it is greater than 5, do not create another bullet:

    If (! _ballCreation_timer) {}

    _ballCreation_timer = new timer (4000);

    _ballCreation_timer.addEventListener (IMER TimerEvent.T, _onBallCreationTimer);

    }

    _ballCreation_timer. Start();

    Function which create the ball based on clock

    function _onBallCreationTimer (e:TimerEvent): void {}

    _doCreateNewBall();

    }

    function _doCreateNewBall() {}

    If (_balls_array.length<>

    _ball_quickobject = sim.addCircle ({x: PHYSICS_SCALE * (960), y: PHYSICS_SCALE * (10), RADIUS: 0.5, draggable: false});

    MAKE A LIST OF BALLS

    _balls_array.push (_ball_quickobject);

    }

    }

    This is the part where if the table (QuickObject) ball falls down and are destroyed

    addEventListener (Event.ENTER_FRAME, _onEnterFrame);

    DRAW EACH BALL FALLING OUT OF THE SCREEN

    function _onEnterFrame (aEvent: Event): void {}

    for each (var quickObject: QuickObject in _balls_array) {}

    BALL FALLING OUT OF THE SCREEN?

    If (quickObject.y / PHYSICS_SCALE > 1080) {}

    _doHandleBallOffScreen (quickObject);

    }

    }

    }

    DESTROY THE BALL FALL OFF THE SCREEN IF

    function _doHandleBallOffScreen (aQuickObject: QuickObject): void {}

    DESTROY THE OBJECT

    aQuickObject.destroy ();

    REMOVE FROM THE CUSTOM TABLE

    _balls_array.splice (_balls_array.indexOf (aQuickObject), 1);

    }

  • How to detect the color pages in a PDF file?

    I use a plug-in of Acrobat C++ read/modify a PDF file.

    I need to get the total number of pages in the PDF file and the page numbers of the pages in color.

    So far, I was able to get the total number of pages using PDDocGetNumPages() with no problems.

    However, I can't find an API that lets me know if a particular page is color or not. Is there a way to do this?

    Thanks in advance!

    But what happens if there are RGB data which means black or grey (R == G == B), that means black or RGB?

    There is a code sample in the SDK to browse content in the PDF file, and then you can get the color space and color of each object.

    But you really need to do background research on the colors & spaces to achieve this properly.

    From: Sachintha81 [email protected]<>[email protected]>

    Reply-To: "[email protected]<>[email protected]> ' [email protected]<>[email protected]>" "

    Date: Wednesday, February 8, 2012 16:57:10-0800

    To: Leonard Rosenthol [email protected]<>[email protected]>

    Topic: How to detect the color pages in a PDF file?

    Re: How to detect the color pages in a PDF file?

    created by Sachintha81http://forums.adobe.com/people/Sachintha81> in Acrobat SDK - see the discussion complete onhttp://forums.adobe.com/message/4194889#4194889

  • How to detect the operating system to PDF using javascript

    Hello

    How to detect the operating system to PDF using javascript. (Javascript console)

    Thanks in advance.

    App.Platform will return "WIN", "MAC" or "UNIX".

  • How to remove the mouse? What is the Quiz Manager?

    I think I found an answer. Click on the Blank. Right?  :-)

    1. I still don't know how to remove the '' mouse. '' Help, please.

    2. I inserted a Question slide and specified as a poll. How can I deselect the 'right answer '? Or, why the second slide that is the result should be added even if it is investigated. Or, how can I get the result of the survey? (this can be advanced skills?)

    3. I deleted the second slide added automatically and a message that says: "if wanting to come back, go to the Quiz Manager. What is the Quiz Manager? Where is he?

    I really appreciate your help.

    ...................................

    > I'm a beginner.

    > I dragged a jpg image she draws on a blade. I got to know that he is sitting on a background. I have found a way to replace it with different images, but cannot find a way to remove it. Could you help me?

    > another Q is, how can I remove mouse? I can move it around, but cannot be removed. THX.

    Post edited by: winnn123

    Post edited by: winnn123

    Sorry I have not responded to your last questions, but we live in different time zones, and I was asleep.

    I am pleased to have been useful. Feel free to ask questions. Captivate deserves to take some time to learn it. I have tried many other software to develop active learning and finally CP has become my absolute favorite. So I want to help the starters as much as possible...

  • Detect the mouse outside the Flex Application action *.

    Hello

    When the mouse action is performed on demand, it's a very simple job to capture the mouse event.
    But what about the mouse action which performed outside the window of the application?

    Anyone know how to capture the mouse event that outside in? Help, please!

    Thank you.

    You can capture the actions of the mouse in the JavaScript in the application wrapper. You'll probably be then to use the ExternalInterface to communicate with the envelope on the actions of the mouse.

    Here is some info on the use of ExternalInterface:

    http://livedocs.Adobe.com/Flex/3/HTML/passingarguments_1.html
    and
    http://livedocs.Adobe.com/Flex/3/HTML/Help.HTML?content=19_External_Interface_04.html
    and
    http://learn.Adobe.com/wiki/display/Flex/external+interface

    HTH,
    Matt Horn
    Flex docs

Maybe you are looking for