Mouse drag and rotation

How do I rotate an object with the mouse after I have dragged the object with mouse. Essentially, I want to move the object with the mouse and then rotate it with another mouse click. Right now the object is moving and rotating at the sime time.

The problem arises due to the CLICK event being determined by the combination of a MOUSE_DOWN event followed by a MOUSE_UP event.  So your CLICK event occurs as soon as you release the drag.  You need to pull assigning the CLICK event out of the dragging scene altogether., otherwise it will be triggered.  One way to do that is to have two clicking functions at work for you.  One that uses the click that registers from the dragging to initiate the listener for other that deals with the rotation.  Here's one way to code it... it removes listeners once they have served their purpose...
graybox.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
function pickUp(event:MouseEvent):void
      event.target.startDrag(true);
      graybox.removeEventListener(MouseEvent.MOUSE_DOWN, pickUp);
      graybox.addEventListener(MouseEvent.MOUSE_UP, dropIt);
function dropIt(event:MouseEvent):void
      event.target.stopDrag();
      graybox.removeEventListener(MouseEvent.MOUSE_UP, dropIt);
      graybox.addEventListener(MouseEvent.CLICK, addClick);
function addClick(event:MouseEvent):void
      graybox.removeEventListener(MouseEvent.CLICK, addClick);
      graybox.addEventListener(MouseEvent.CLICK, onClick);
function onClick(event:MouseEvent):void
     event.target.rotation+=5;
     graybox.removeEventListener(MouseEvent.CLICK, onClick);
     graybox.addEventListener(MouseEvent.MOUSE_DOWN, pickUp);
graybox.buttonMode=true;

Similar Messages

  • Drag and rotate with multi touch

    i want to drag and rotate an imageview by using two fingers which will make the image look like a real object. I am able to move and rotate it,but at different time. I want to do it simultaneously. i think this can be done by calculating the angle between touches and then deciding the gesture and move and rotate accordingly. But can make out how to do it?
    Thanks for the reply.

    open flash, create a new actionscript file and paste the code
    that's below the dotted line into the as file and save as
    regPoint.as in the same directory as your project files.
    in your project fla attach the following to a frame

  • Mouse - Drag and drop not working

    The Drag and drop feature is not working with my mouse. The mouse was tested and is fine. It's a software thing. It works with everything else, but if I try to select something and drag it, it doesn't work. Any advice?

    PaulyK,
    Believe it or not it may take multiple or several restarts....not just a couple. I have seen where it took 5 or 6. I have also seen where this did not clear the problem.
    re: "Any other upgrades that might help with out having to buy new software"
    The 10.2.8 update to Jaguar was the last before the "upgrade" to 10.3 Panther which is a paid upgrade.
    There is a third party utility Dragster that may correct this problem or you can delete the associated files that it deletes manually. The files are:
    com.apple.desktop.plist
    com.apple.dock.plist (your choice to delete this or not)
    com.apple.finder.plist
    com.apple.LaunchServices.LocalCache.csstore
    com.apple.LaunchServices. plist
    com.apple.LauchServices. UserCache.csstore
    LSApplications
    LSClaimedTypes
    LSSchemes
    The contents of the /Library/Caches/ folder
    You should have no problem with this utility or deleting the files manually if you go that route but I cannot vouch for it as it is third party....Use at your own risk!
    edit: I just noticed that the link is no longer working for Dragster and the software now is part of a retired collection of apps from ifthen software.
    If after multiple restarts and/or using Dragster or manually deleting the associated problem files you have no luck you might want to try applying the 10.2.8 Combo Update again to see if this will clear up the problem. Remember to repair permissions from Disk Utility before and after the update.
    The Combo Update can be found here.
    Post back if still no luck,
    littleshoulders [:-)
    Message was edited by: littleshoulders

  • Move components using mouse - drag and drop action?

    Hi,
    As attached, I want to move one component at the bottom to top using mouse in drag and drop action.
    But I don't know why it returns to the origianl position. it never move.
    Is there anyway I can change configuration to accomplish this?

    Hi,
    I tried this as you said, but it wont' work.

  • Drag and Rotate

    Hi all,
    i'm working on a projekt, which is a card game and i need to
    implement some kind of rotation function.
    Actually i can drag, pick up and drop the cards.
    Now i want the cards to rotate depending on the movement of
    the users mouse when he drags a card.
    I tried to do it on my own but i can't figure it out.
    As an example of what i mean check this link please:
    Thibaud.be
    I don't need a complete solution but an advice or a link to a
    tutorial that deals with this kind of problem would be very nice.
    Thank you very much.

    open flash, create a new actionscript file and paste the code
    that's below the dotted line into the as file and save as
    regPoint.as in the same directory as your project files.
    in your project fla attach the following to a frame

  • Mouse dragging cycle region not working What am I missing?

    Hi,
    Pretty new to STP. I'm using STP 2.02. I'm following a on line tutorial whereby the person just simply mouse drags and highlights a section on the waveform a section they wish to remove by command delete. dragging my mouse does nothing but move the entire audio clip.
    I feel like a retard, seems like the easiest thing to do yet I can't figure it out..
    Any guidance would be great.
    Cheers

    i figured it out. I just had to open the aiff file rather than bring it in via FC..
    thanks!

  • 360 degree rotate image mouse drag edge tutorial

    360 degree rotate image mouse drag edge tutorial and give edge file

    My thoughts would be to, use an event listener for mouse
    down.. then depending on where the mouse is down have it create
    another event listener for mouse move, for example if the mouse x
    and y was in the range of where you want.. And after that in the
    mouse move function create a tween depending on where the mouse x
    or why moves to.
    private function mouseDOWN(evt:MouseEvent):void{
    //if mouse x or y is in the position rang wanted, create the
    event listener for mouse movement and mouse up.
    private function mouseMOVED(evt:MouseEvent):void{
    //if mouse y moved from original position, figure out the
    difference
    // create a tween on the object's original location, and
    addition of the difference.
    private function mouseUP(evt:MouseEvent):void{
    // remove all of the event listeners to stop all
    interaction. Also removing the mouse up listener.
    hope this helps

  • JTable custom selection and mouse drag events

    Hello
    I am currently experiencing a problem when using a JTable and a custom selection. I have made a small example to demonstrate the probem. Selection works for this example by listening for when the user clicks or clicks and drags (button held down) and moves the mouse across cells in the table. For each MouseEvent received in the MouseMotionListener mouseDragged method I store the coordinates of that cell at the point of the mouse and render the cell at those coordinates with a line border allowing a more versatile cell selection. The problem that occurs is when you click+drag and move the mouse fast, it looks MouseEvents are created every x milliseconds so when you move fast there isn't a MouseEvent raised for each cell in the click+drag from A -> B. If you run the following example then click and hold down the mouse button and move fast downwards from the top of the table to the bottom you can see that not all the cells are selected vertically.
    Is there someway of increasing the mouse poll (if this is indeed the problem) during the click+drag or a better solution to this problem that any one knows!?
    I have tried attaching the example but it exceeded the message length for the forum post here is a link to code
    [http://www.oneandonlyluppy.pwp.blueyonder.co.uk/TableTest.java]
    [http://www.oneandonlyluppy.pwp.blueyonder.co.uk/TableTest.zip] <-- Contains the source and compiled classes
    I'll try adding the code again as a separate post
    Thanks
    Edited by: oneandonlyluppy on Jan 8, 2009 2:44 AM
    Edited by: oneandonlyluppy on Jan 8, 2009 2:45 AM

    AFAIK the mouse polling rate is OS dependent (being interrupt driven), and may even be affected by processor load. What you could do is store the mouse location (Point) of the last mouseDragged event, and compute a line to the current location, then use some coordinate geometry to identify any intervening cells which are presently being skipped.
    db

  • I can no longer drag and drop things in Photoshop Elements 12. I can move things with my keyboard, but not my mouse. WHAT IS HAPPENING?!

    When I got Elements 12 (May 2014), I was able to drag and drop things such as cut/pasted items, watermarks, etc. As of 2 weeks ago, I can no longer use my mouse to drag and drop. If I try, it just snaps back wherever it was before I tried to drag it. With that said, the item will move if I use my keyboard. It takes an eternity. WHAT IS GOING ON?! I just really want to use my mouse again...

    Install the 10.10.1 update. That should do it.

  • [SOLVED] Thunar 1.6 doesn't drag-and-drop with the right mouse button

    Hallo all.
    It might be something I've done (though I did delete my ~/.config/Thunar directory before upgrading), but Thunar doesn't let me drag-and-drop with the right mouse button, thus stopping me from copying something instead of moving it, etc. Has anyone else had that too?
    Last edited by GordonGR (2012-12-28 14:34:20)

    Joel wrote:
    anonymous_user wrote:Is it supposed to be with the right-mouse button? I always thought drag and drop was done with the left button?
    Could be right-hand user
    Come on! Read what GordonGR wrote!
    Microsoft Windows, Nautilus, the Haiku Tracker, and probably many other file managers have a feature where, when you right-click or middle-click and drag an icon to a new location, a pop-up menu appears and asks what you'd like to do (Move, Copy, Link). I thought I used to use this feature in Thunar too but it seems to have stopped working in recent versions. Has anyone else had any experience with it?
    EDIT: Here's random blogger talking about the feature in an older version of Thunar: http://jeromeg.blog.free.fr/index.php?p … and-tricks So that's good, I wasn't just imagining the feature.
    Last edited by drcouzelis (2012-12-12 03:45:05)

  • How to I drag and drop from Customize Add On using a Wireless Mouse on a Laptop?

    I have been assisting a friend in installing Firefox. I have added Add On, but I cannot drag and drop them into the toolbars on the top. The tiny weenie add on tool bar stinks for those of us who are older and have weakened eyesight. How Can I Drap and Drop into the Toolbars on the Top using a laptop without a mouse?

    PS. I also tried drag-and-dropping to Photoshop, and it doesn't work either.
    I did more research online, and the more I research this, the more it seems that the LIGHTROOM DRAG AND DROP functionality works on MAC but not on PC...
    If it is the case, this would be a major annoyance.
    Some people said this feature worked on PC in Windows Vista.
    I tried running LR in compatibility more (Vista SP2), but this did not fix the issue.
    I am starting to wonder if this is a problem with LR running on WINDOWS x64 systems... (I am running WIN7 x64)

  • Can't drag and drop in Finder with trackpad or magic mouse

    I can't seem to drag and drop anthing in the Finder window since updating to Mavericks (10.9). I've tried changing all magic mouse and trackpad settings.  I can drag and drop windows and apps on the dock.  No sure what the issue is....any help is appreciated!

    Had the same problem. Reinstalled the software - all is well. Cured many ills with the initial installation - don't bother trying to play with permissions, etc. Just reinstall.
    Thank goodness this isn't Micro$oft or you'd have to sit in front of the computer to keep answering the "Okay to reboot" questions every time a chunk of code is installed.

  • Bug? Can't Drag and Hold Mouse Photoshop CS6 on Windows 8 RP

    I am having a few problems with the current Photoshop CS6 on Windows 8RP.
    At first it was only the tilit shift and iris but it turns out it's everything to do with when you need to hold the mouse button and drag. It seems that the problem is isolated to Photoshop as other Adobe programmes are working fine plus other programmes and Windows generally is also fine.
    I am using an Nvidia GTX580 with Windows 7 drivers until the proper version comes which is late of course!
    Plus, I uninstalled my Intellipoint and keyboard drivers too and connected a generic mouse via USB and I still get the same problem.
    Weirdly though, every (let's say) 20 times I try to drag and hold after constantly restarting Photoshop it works once then I have to try again a load of times by restarting the application.
    Any ideas?
    Joe

    I'm running photoshop cs6 on windows 8 RP 64 bits and haven't seen that problem
    and i didn't see that on the consumer preview either.
    This is the driver i'm using:
    http://www.nvidia.com/object/win8-64bit-296.17-preview-driver.html
    Just watch that windows update doesn't try to sneak in there own driver.
    It happened to me twice until i changed the automatic updates to notify
    and also watch that doesn't happen with your monitor profile as well.
    The updated Nvidia drivers for rp are supposed to be released sometime this coming week.
    Do you have any third party plugins or do you have the scriptlistener installed?
    Did you try resetting the photoshop preferences or difference modes under the Advanced setting for the the graphics processor under preferences>preformance in photoshop?

  • Drag and drop feature on the project panel doesnt work. Cant adjust scale or any numer properties by sliding mouse. (click drag wont work at all nowhere)

    This issue just happened out of the blue. The last thing I did was create a new comp and import an Illustrator file.  Working on CC2014. Its like the mouse's left click wont be working at all... but that's not the case.  Cant even drag the comps in the composition, or move the layers around....
    Now the issue affects everything I do in After Effects, even on a new comp with just a plain solid
    Deleted cache,
    reseted workspaces,
    open/close after effects
    restarted computer
    newcomp with just a solid and nothing.
    plugged unplugged wireless mouse
    changed to wired mouse
    the issue is still there
    Curiously, after writing this post , publishing, and going back to after effects, the mouse will work, but for a couple of clicks or so then wont work again. This only happens on After Effects
    Mensaje editado por: Oswaldo Montúfar

    You're Right
    Its an Gigabyte GA-Z68XP-UD4   with an i7 k2600 clocked to 4.2ghz   w 16gbRam at 1333mhz
    Dual GPU , gtx 760 and gtx 780ti
    Running Windows 7 ultimate.
    The keyboard is a Genius G110  plus a wireless mouse Genius also.
    Adobe guys tried resetting cache (different than deleting) and user preferences, creating new user, disabling both video cards . The issue was still there.
    BTW!, After I switched windows in Win7 environment ( from after effects to the browser)  the mouse drag worked again. I could move objects in comp window, scale; move sliders on time line and drag projects to folders in project window... everything fine until i pressed ANY key, say, shift key or ctrl key.
    Probably we will never have the answer for this, since i had to format the C drive  (i have work to do). Currently i'm installing CC again. So if problem persists, I'll ditch the computer through the window.

  • Mouse event not fires on drag and drop

    Please
    Can any one help and give any idea during draging(drag drop) mouse over of a button does not fires. I have a list of thumb in which I want to drag and drop the thumb at any location for reordering the thumb but due to  lot of item in list need to sscroll list.  I have my own custom scroll on button mouse over but when Item is dragging  mouse event does not fires.
    Thanks in advance,
    Premkant

    Hi there,
    Reject caption shows up when an unacceptable source is dropped on a Target. To configure the 'Accept criteria', select a drop target, Click on the 'Accept' button, Deselect the checkbox corresponding to the unacceptable source. (As shown below)
    Now whenever the user drops 'Unaccept' source on top of the target, the 'Reject' caption shows up.
    Thanks,
    Nimmy Sukumaran.

Maybe you are looking for