How to code a click and drag forward/backward in the timeline

I'm working on a project, the goal is to have a .swf as thisanimation.

The feature I'm looking for is:

1. I need my animated film to make a complete rotation and stop,

and then

2. I need to fix my AS3 so you HOLD/CLICK/DRAG to progress forward and backward through the timeline, but only when your now the mouse button down.

Currently, the code progresses the frame forward and backward position mouseX.

Here is my current code:

import flash.events.MouseEvent;

var startPosition:Number = mouseX;

var delayTime = 10;

gotoAndStop (1);

stage.addEventListener (MouseEvent.MOUSE_MOVE, onMouse);

function onMouse(e:MouseEvent):void {}

stage.removeEventListener (MouseEvent.MOUSE_MOVE, onMouse);

var currentPosition:Number = mouseX;

If (mouseX-startPosition < = 0) {}

nextFrame();

} else {}

prevFrame();

}

setTimeout (setListener, delayTime);

}

function setListener() {}

startPosition = mouseX;

stage.addEventListener (MouseEvent.MOUSE_MOVE, onMouse);

}

any help would be appreciated,

Thank you.

Found a thread a little like the one that has solved all my problems

Here is the link for all those who might be pulling their hair trying to figure this out in the future

http://forums.Adobe.com/thread/570903?TSTART=0

Thank you Adobe Forums

Tags: Adobe Animate

Similar Questions

  • not by clicking and dragging the mouse

    My mouse pointer responds well to move around the screen and double check etc. However when I try to click and drag he 'loses' of the object (file name or Freecell card) or will not select what I go & drag. All the drivers are up to date. I removed, waited and then replaced the Bluetooth USB mount to the back of the computer and the batteries are charged. Any ideas?

    HP TouchSmart 520-1010ukH

    Mouse Microsoft MG-0982 model

    Windows 7

    Hello @itsmagicvi,

    Welcome to the HP Forums, I hope you enjoy your experience! To help you get the most out of the Forums of HP, I would like to draw your attention to the Guide of the Forums HP first time here? Learn how to publish and more.

    I understand that you are having problems with your Microsoft Mouse on your home PC HP TouchSmart 520-1085uk not allowing you click and drag or use drag to select. I'd be happy to help you, but first of all, I encourage you to post what operating system you are using. And if your 32-bit OS or 64 bits like this that I can give you accurate information.

    Operating system Windows am I running?
    Is the Version of Windows on my computer 32-bit or 64-bit?

    Another thing you can try is the mouse on another computer to see if you encounter the same problem or if you are unable to do this test using a different mouse on your computer to see if the problem repeats.

    Will you please re-post with the information requested and I would be happy to provide assistance. Thanks for posting on the HP Forums. Have a great day!

  • When I left click and drag on my desk his blue gray not how to fix this?

    When I left click and drag on my desktop its usually blue and rather theres nothing in the box is just my backround

     
    http://i1135.Photobucket.com/albums/m623/Clarrifyy/Untitled-1.PNG
    like that, I want to correct this

    1. type the word appears in the search box of your Start menu, and then choose adjust performance and appearance of Windows.

    2. in the list, "use transparent selection rectangle" lights up, and then click OK.
  • Click and drag to control the frame advance

    I have a layer that contains a video clip instance named wwr_mc, who has 19 frames. I figured out how to script, a function of turning constantly move from one image to the other by rolling on the prev or next buttons, using this code:

    wwr_mc.gotoAndStop (10);

    var t:Timer = new Timer (250.0);
    var dir:int;

    t.addEventListener (TimerEvent.TIMER, onNextFrame);

    next_btn.addEventListener (MouseEvent.ROLL_OVER, Right);
    next_btn.addEventListener (MouseEvent.ROLL_OUT, stopIF);
    function right(e:MouseEvent): void {}
    dir = - 1;
    t.Start ();
    wwr_mc.nextFrame ();
    }
    prev_btn.addEventListener (MouseEvent.ROLL_OVER, Left);
    prev_btn.addEventListener (MouseEvent.ROLL_OUT, stopIF);
    function left(e:MouseEvent): void {}
    dir = + 1;
    t.Start ();
    wwr_mc.prevFrame ();
    }
    function stopIF(e:Event): void {}
    t.Stop ();
    }
    function onNextFrame(e:TimerEvent): void {}
    wwr_mc.gotoAndStop (wwr_mc.currentFrame + dir);

    }

    This type of navigation, although functional, isn't really codusive what I am trying to accomplish. I would like to be able to click and drag the mouse and have the frameworks to advance forward or backward according to the direction of movement of the mouse.

    I tried to use the MOUSE_Move event with very limited success.

    Any suggestions would be helpful!

    Thank you!

    I don't see anything through this link that I can relate to this announcement.

    If you want to change managers only based on orientation (x) that the mouse is moved, then you need to test the current position of the mouse to the last known position...

    var startPosition:Number = mouseX;

    wwr_mc.gotoAndStop (10);

    stage.addEventListener (MouseEvent.MOUSE_MOVE, onMouse);

    function onMouse(e:MouseEvent): void {}
    If (mouseX-startPosition > = 0) {}
    wwr_mc.nextFrame ();
    } else {}
    wwr_mc.prevFrame ();
    }
    startPosition = mouseX;
    }

    I don't know what you find as being too fast.  When you do things from an event extended, such as a mouse moved for a while, then it is likely that the event runs the event handler function several times... as fast as the rate of the file allows it.  So if you want more control over the speed at which function nextFrame/prevFrame to mouse moves effect calls, then you must build in some form of delay.  In the example below, it takes the form to remove the mouse event listener move for a short period using a synchronization function (setTimeout in this example, but you can use the Timer class as well)

    var startPosition:Number = mouseX;
    var delayTime = 250; 0.25 s

    wwr_mc.gotoAndStop (10);

    stage.addEventListener (MouseEvent.MOUSE_MOVE, onMouse);

    function onMouse(e:MouseEvent): void {}
    stage.removeEventListener (MouseEvent.MOUSE_MOVE, onMouse);
    var currentPosition:Number = mouseX;
    If (currentPosition-startPosition > = 0) {}
    wwr_mc.nextFrame ();
    } else {}
    wwr_mc.prevFrame ();
    }
    setTimeout (setListener, delayTime);
    }

    function setListener() {}
    startPosition = mouseX;
    stage.addEventListener (MouseEvent.MOUSE_MOVE, onMouse);
    }

  • Click and drag the question (Beginner)

    Hello, so I have a very simple program where I would like the user to be able to drag the object to the statue and place it on a pedestal. I started with the click and drag, but the code did not work when I used it. I tried to use the code snippets of live code, and that no longer works. After a trace in the click function, I found that he has not been called. They are called the same, and the mouse_up function was working properly, then I don't know what the problem is. Any help would be greatly appreciated ~

    Here is the code, the important bits are in bold. I don't get any other error ~.

    package

    {

    import flash.display. *;

    import flash.events. *;

    flash.ui import. *;

    try public class extends flash.display.MovieClip

    {

    var rightIsPressed:Boolean = false;

    public void retry()

    {

    Add listeners to drag

    trace ("it's working");

    make the invisible instructions

    controlText.alpha = 0;

    call event listeners

    nextBtn.addEventListener (MouseEvent.CLICK, seeManga);

    startBtn.addEventListener (MouseEvent.CLICK, beginManga);

    controlText.addEventListener (MouseEvent.MOUSE_OVER, showText);

    controlText.addEventListener (MouseEvent.MOUSE_OUT, hideText);

    walkinganimation.addEventListener (Event.ENTER_FRAME, fl_MoveInDirectionOfKey_3);

    stage.addEventListener (KeyboardEvent.KEY_DOWN, fl_SetKeyPressed_3);

    stage.addEventListener (KeyboardEvent.KEY_UP, fl_UnsetKeyPressed_3);

    statue.addEventListener (MouseEvent.MOUSE_DOWN, fl_ClickToDrag);

    statue.addEventListener (MouseEvent.MOUSE_UP, fl_ReleaseToDrop);

    }

    function fl_ClickToDrag(event:MouseEvent)

    {

    var object = (event.currentTarget);

    object.startDrag ();

    }

    function fl_ReleaseToDrop(event:MouseEvent)

    {

    var object = (event.currentTarget ;)

    object.stopDrag ();

    }

    start the functions

    function showText(event:MouseEvent)

    {

    trace ("mouse in");

    controlText.alpha = 1;

    }

    function hideText(event:MouseEvent)

    {

    trace ("mouse over");

    controlText.alpha = 0;

    }

    function beginManga(event:MouseEvent)

    {

    gotoAndStop (2);

    }

    function seeManga(event:MouseEvent)

    {

    trace ("2nd button");

    nextFrame();

    }

    function fl_MoveInDirectionOfKey_3(event:Event)

    {

    If (rightIsPressed)

    {

    trace ("keyboard pressed');

    walkinganimation.gotoAndStop (2);

    Foreground.x-= 3.5;

    Text1.x-= 2;

    Text2.x-= 2;

    Text3.x-= 2;

    Text4.x-= 2;

    Pedastal.x-= 3.0;

    statue.x = 3.0;

    }

    }

    function fl_SetKeyPressed_3(event:KeyboardEvent):void

    {

    switch (event.keyCode)

    {

    case Keyboard.RIGHT:

    {

    rightIsPressed = true;

    break;

    }

    }

    }

    function fl_UnsetKeyPressed_3(event:KeyboardEvent):void

    {

    switch (event.keyCode)

    {

    case Keyboard.RIGHT:

    {

    rightIsPressed = false;

    walkinganimation.gotoAndStop (1);

    break;

    }

    }

    }

    }

    }

    Initially, you said that you don't get other errors, but you get the error messages at all?

    How you implement this class file in your Flash file?

    You happen to have anything that could block access to the object of the statue?

    To animate the object of the statue in place such that it is not named in frames before the framework where your code is trying to work with her?

  • When I click and drag a window to move its location on the screen does not move properly.

    When I click and drag a window to move its location on the screen does not move properly. It leaves a "track" of windows. Whatever the problem is scroll is also affected when the page moves in waves. Why he started to do this, and if someone can offer a solution? Thank you!

    original title: "leakage" of windows

    It is a common problem with how XP displays the items on your screen. When things get a bit bogged down, you'll start to see trails of the window as you drag. Unfortunately, there is no solution, but future versions of Windows do not have this problem with a new rendering of the graphics system.

  • The task bar is not locked, but he won't move in right or left clicking and dragging.

    original title: taskbar is not locked, but he won't move in right or left clicking and dragging. Tried a different mouse, no results.

    The task bar will not move but not locked.

    Click to the right or left mouse drag, nothing happens.
    Used another mouse, still no movement.

    Hello

    Method 1:

    Try to make an auditor of the system files on your computer and search for errors on the disc: How to use the tool File Checker system to troubleshoot missing or corrupted system files on Windows Vista or Windows 7 http://support.microsoft.com/kb/929833

    Method 2:

    Step 1:

    Start the computer in safe mode and see if the problem occurs. Follow the steps from the link to start in safe mode: http://windows.microsoft.com/en-US/windows7/Start-your-computer-in-safe-mode

    Step 2:

    Start the computer and check to see if this helps: How to troubleshoot a problem by performing a clean Windows Vista or Windows 7 boot http://support.microsoft.com/kb/929135

    Note: when you are finished troubleshooting, follow step 7 to start the computer in normal startup.

    Method 3:

    Step 1:

    Try creating a new user account and check if it works very well: http://windows.microsoft.com/en-us/Windows7/Create-a-user-account

    Step 2:

    If it works fine, then try to move the files and folders from the old account to the new user account user: http://windows.microsoft.com/en-US/Windows7/Fix-a-corrupted-user-profile

  • Interim effect parameter click-and - drag "sticky"?

    Hey everybody!  I tried searching for the same problem, but I didn't even really know how to describe concisely...

    So when I work with a purpose and I want to change a parameter... I will use crops as an example... If I want to change the culture of the left, I can move just my mouse on %, click and drag left or right to adjust the setting.  For the last month or so, however, I noticed that, in order to get the amount to change, I really need to move a long way before it begins to change, of course, he will swing wildly too far then and I have to bring back that I wanted her to be in first place.  It's as if the setting is "sticky" and I have to break this "rigidity" so he can start moving.  Once it starts moving, it moves and behaves normally.  Y at - it a name so that the initial resistance and y at - it a setting anywhere to adjust it?  I've been putting upward with her for about a month now (I don't remember doing this before this date) and now I'm at the point where it drives me crazy.

    To review:

    Cultures, for example

    I take the '0% ' to try to drag up to about 10-15% or more.

    But it does not move until I have hanging elsewhere out of hell, then it rises to 50% or more.

    Then I can call him and he slips back normally.

    This question of the effects of all the effects that I have used, including the standard scale, Position, Rotation, etc.  So I don't think it's specific to a given effect, but to the interface itself.


    Is anyone else having this experience or can give me any idea how to fix?

    Not for me. He responds immediately.


    Brick.

    Hold down the shift + alt key while rebooting first.

    Maybe this will help.

  • When I choose my quick selection tool, I click and drag the first time, and he adds (my selection). BUT if I let go of the mouse button and try to select more it goes to Negative (-) and removes all selections I made and won't allow me not one

    When I choose my quick selection tool, I click and drag the first time, and he adds (my selection). BUT if I let go the mouse button and try to select it goes to Negative (-) and removes all the selections I made and not will not let me add again. I never had this problem before, you usually need to hold down the Alt (or Option MAC) to subtract from selections. No one knows what happened or how to fix this problem, maybe a setting I accidentally hit? Thanks for your suggestions! :))

    Look at the options of quick selection - particularly the four icons on the left.

  • Does anyone know why illustrator did several objects when I click and drag? No key keyboard shortcuts; only with the mouse.

    When I make a square for example, click and drag with the mouse, it makes duplicate objects until I release the mouse click. How can I disable this feature? Thank you.

    Danopoly,

    How can I disable this feature?

    By unstucking the Tilde (~) key.
  • Click and drag the feature does not

    MY click and drag feature in Photoshop elements does not work when you use pot, brush, Eraser, etc. How can I fix it?

    Does PES 12 on Yosemite? If so, see:

    Photoshop Elements unresponsive after upgrading from Mac OS to Yosemite

  • Cannot left click and drag the clip in the timeline... Need advice

    Cannot left click and drag the clip in the timeline or drag autour clips in the timeline.

    Can be inserted into the timeline of the Source window, but cannot drag from the source window.

    Can cut and paste into the timeline.

    Cs5 restarting does not help, but restarting solves the problem for a while.

    Tried several mice, but that did not help.

    Have no idea how I got the name of FORMER PRO, must have been drinking champagne years, because I'm a blundering by excellence!

    Post edited by: old pro

    Problem solved by pressing the ESC key.

    Someone suggested that in order to heal the same problem in MS Word.

    Problem reappears and solves the ESC key.

    And now my life is complete!

  • Can't click and drag to select anything in the Apple Pages

    I worked for hours on this unanswered anywhere on the internet.

    I can't click and drag to select text in the Apple Pages. I can click and drag to select text in other applications on the same computer, but in the Pages, I can't click and drag. It will show the text highlight for a fraction of a second, and then it will disappear. I can't copy or cut, because it will not select it. If I select the text with clicking and then holding down the SHIFT key and then clicking on at the end of the text, he chooses for me. But clicking and slippery will only highlight, then disappear. What's wrong???

    I have

    • computer restarts
    • restarted apple pages
    • trashed plists iWork (cannot find a specific pages plist)
    • Troubleshoot-made form another computer by comparing the preferences, settings, all on the same version of Pages
    • sought objects to make them 'selectable' (there is no objects, and this happens on all documents, including new pages documents I just create and try to highlight a Word)

    I'm on an iMac OSx 10.11.5 end 2013

    Apple Pages 5.6.2 (2573)

    It is a long-standing problem in OS X, are not specifically in any version of the Pages. Have you tried clicking & holding it down for a second or two in the text before you drag?

  • Click and drag in the Favorites or in text fields does not

    Click and drag does not work with favorites anywhere, or any text fields. He used to work a lot in v11, but not v12

    I tried to revert to my version of Firefox v11 backup but it keeps automatically updated to v12 despite disabling auto update in the preferences and even when it is offline - frustrating.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox/tools > Modules > appearance/themes).

  • I click and drag the music from my library to a new playlist and some songs are dark and will not play on my device.  Why?

    I click and drag the music a new reading list, but some songs are not highlighted in the play list and will not play on my device.  Why?

    Try two things...

    (1) the songs greyed out can be unchecked. Uncheck the songs are normally excluded from track to track synchronization and normal. With the help of the songs or the list view Ctrl + click on an empty box to check all the boxes in the list of active reading.

    (2) try to go to file > library > Update music library to iCloud and do the update.

Maybe you are looking for