Rotate and stop rotating an object

Hi
I want to rotate an object using the arrows on the keyboard when the mouse is over the object and it should not be possible to rotate the object when the mouse is not on the object.
I know how to rotate the object, when the mouse is over the object, but when I put the mouse outside the object I can still rotate the object. How do I make the rotation stop?
square1.addEventListener(MouseEvent.MOUSE_OVER, around);
square1.addEventListener(MouseEvent.MOUSE_OUT, normal);
function around(e:MouseEvent):void {
stage.addEventListener(KeyboardEvent.KEY_DOWN, rotate);
function rotate(event:KeyboardEvent):void {
switch (event.keyCode)
case Keyboard.RIGHT:
square1.rotation += 90;
break;
case Keyboard.LEFT:
square1.rotation -=90;
break;
function normal(e:MouseEvent):void {
     trace("The object should not be rotating");
Thanks

use:
square1.addEventListener(MouseEvent.MOUSE_OVER, around);
square1.addEventListener(MouseEvent.MOUSE_OUT, normal);
function around(e:MouseEvent):void {
stage.addEventListener(KeyboardEvent.KEY_DOWN, rotate);
function rotate(event:KeyboardEvent):void {
switch (event.keyCode)
case Keyboard.RIGHT:
square1.rotation += 90;
break;
case Keyboard.LEFT:
square1.rotation -=90;
break;
function normal(e:MouseEvent):void {
stage.removeEventListener(KeyboardEvent.KEY_DOWN, rotate);

Similar Messages

  • Some of my rotation animation is stepping at about one degree increments instead of tweening smoothly.  I'm using classic tweening.  I see that if I select the whole interval and use F6 to convert every tween frame to a key and then select the object at t

    Some of my rotation animation is stepping at about one degree increments instead of tweening smoothly.  I'm using classic tweening.  I see that if I select the whole interval and use F6 to convert every tween frame to a key and then select the object at the different frames, that I see under transform that the skew values are changes from frame to frame aroung that same one degree range.  Is there a solution to this?

    Some of my rotation animation is stepping at about one degree increments instead of tweening smoothly.  I'm using classic tweening.  I see that if I select the whole interval and use F6 to convert every tween frame to a key and then select the object at the different frames, that I see under transform that the skew values are changes from frame to frame aroung that same one degree range.  Is there a solution to this?

  • In Macromedia Flash8 we had an option insert timeline effects rotate. Do we have any option to rotate an object in Adobe Flash cs5 and above

    in Macromedia Flash8 we had an option insert>timeline effects>rotate. Do we have any option to rotate an object in Adobe Flash cs5 and above.

    You can also use the following:
    1 Select the object to rotate > Right Click > Create Motion Tween.
    2 Click on the last frame of the Motion tween and choose the desired Rotation settings from Properties panel.

  • Problem in moving Rotated Shape object

    Hi All,
    I want to move the rotated shape object based on the mouse movement
    m able to move the object which is not rotated, but m facing the problem when i move the rotated object its moving position is not correct . I am expecting to maintain both shape objects movement is same, i mean if i did mouse movement to right rotated object moves upwards and normal object moves towards right insted of moving both r moving towards to right.
    Pls help me
    the following code is m using to moving the object
    The one which in red color is not rotated and the one which is in black color has rotated.
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import java.awt.Shape;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.geom.AffineTransform;
    import java.awt.geom.Point2D;
    import java.awt.geom.Rectangle2D;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import com.clinapps.LDPConstants;
    public class MoveRotatedObj extends JFrame
         public MoveRotatedObj()
              JPanel pane = new Dorairaj();
              add(pane);
         public static void main(String[] args)
              MoveRotatedObj f = new MoveRotatedObj();
              f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              f.setSize(400, 400);
              f.setLocation(200, 200);
              f.setVisible(true);
         static class Dorairaj extends JPanel
              implements
                   MouseListener,
                   MouseMotionListener
              Shape o = null;
              Rectangle2D rect = new Rectangle2D.Double(
                   10, 10, 100, 100);
              Graphics2D g2 = null;
              boolean flag = true;
              int x=10,y=10,x1, y1, x2, y2;
              AffineTransform af = new AffineTransform();
              AffineTransform originalAt = new AffineTransform();
              int origin = 0;
              public Dorairaj()
                   addMouseListener(this);
                   addMouseMotionListener(this);
              protected void paintComponent(Graphics g)
                   super.paintComponent(g);
                   g2 = (Graphics2D) g;
                   g2.draw(new Rectangle2D.Double(0,0,500,500));
                   g2.translate(origin, origin);
                   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
                   rect = new Rectangle2D.Double(
                        x, y, 150, 100);
                   g2.setColor(Color.RED);
                   g2.draw(rect);
                   g2.setColor(Color.black);
                   originalAt = g2.getTransform();
                   g2.rotate(Math.toRadians(270), 200, 200);               
                   g2.draw(rect);
                   g2.setTransform(originalAt);
              * Invoked when a mouse button has been pressed on a component.
              public void mousePressed(MouseEvent e)
                   e.translatePoint(-origin, -origin);
                   x1 = e.getX();
                   y1 = e.getY();
              public void mouseDragged(MouseEvent e)
                   x2 = e.getX();
                   y2 = e.getY();
                   x = x + x2 - x1;
                   y = y + y2 - y1;
                   x1 = x2;
                   y1 = y2;
                   repaint();
              public void mouseMoved(MouseEvent e)
              * Invoked when the mouse button has been clicked (pressed and released)
              * on a component.
              public void mouseClicked(MouseEvent e)
                   repaint();
              * Invoked when a mouse button has been released on a component.
              public void mouseReleased(MouseEvent e)
              * Invoked when the mouse enters a component.
              public void mouseEntered(MouseEvent e)
              * Invoked when the mouse exits a component.
              public void mouseExited(MouseEvent e)
    Edited by: DoraiRaj on Sep 16, 2009 12:51 PM
    Edited by: DoraiRaj on Sep 16, 2009 1:00 PM
    Edited by: DoraiRaj on Sep 16, 2009 1:07 PM

    Thanks for replay and suggestion morgalr,
    I mean MoveRotatedObj1 is MoveRotatedObj only jsut m maintaing a copy on my system like MoveRotatedObj1.
    finally i solved my problem like this ,
    Is this correct approach m followinig or not pls let me know .
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import java.awt.Shape;
    import java.awt.event.MouseEvent;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseMotionListener;
    import java.awt.geom.AffineTransform;
    import java.awt.geom.Point2D;
    import java.awt.geom.Rectangle2D;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    import com.clinapps.LDPConstants;
    public class MoveRotatedObj extends JFrame
    public MoveRotatedObj()
      JPanel pane = new Dorairaj();
      add(pane);
    public static void main(String[] args)
      MoveRotatedObj f = new MoveRotatedObj();
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setSize(400, 400);
      f.setLocation(200, 200);
      f.setVisible(true);
    static class Dorairaj extends JPanel
      implements
       MouseListener,
       MouseMotionListener
      Shape o = null;
      Rectangle2D rect = new Rectangle2D.Double(
       10, 10, 100, 100);
      Rectangle2D rect1 = new Rectangle2D.Double(
       10, 10, 100, 100);
      Graphics2D g2 = null;
      boolean flag = true;
      double lx, ly;
      int x = 10, y = 10, x1, y1, x2, y2;
      int l = 20, m = 20;
      int angle = 270;
      AffineTransform af = new AffineTransform();
      AffineTransform originalAt = new AffineTransform();
      int origin = 0;
      public Dorairaj()
       addMouseListener(this);
       addMouseMotionListener(this);
      protected void paintComponent(Graphics g)
       super.paintComponent(g);
       g2 = (Graphics2D) g;
       g2.draw(new Rectangle2D.Double(
        0, 0, 500, 500));
       g2.translate(origin, origin);
       g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);
       rect = new Rectangle2D.Double(
        x, y, 150, 100);
       g2.setColor(Color.RED);
       g2.draw(rect);
       rect1 = new Rectangle2D.Double(
        l, m, 150, 100);
       g2.setColor(Color.black);
       originalAt = g2.getTransform();
       g2.rotate(Math.toRadians(angle), 200, 200);
       g2.draw(rect1);
       g2.setTransform(originalAt);
      public void mousePressed(MouseEvent e)
       e.translatePoint(-origin, -origin);
       x1 = e.getX();
       y1 = e.getY();
      public void mouseDragged(MouseEvent e)
       boolean left, right, up, bottm;
       int dx, dy;
       left = right = up = bottm = false;
       x2 = e.getX();
       y2 = e.getY();
       dx = x2 - x1;
       dy = y2 - y1;
       x = x + dx;
       y = y + dy;
       up = dy < 0;
       bottm = dy > 0;
       left = dx < 0;
       right = dx > 0;
       if (left || right)
        // b += dx;
        m += dx;
       if (up || bottm)
        // a -= dy;
        l -= dy;
       x1 = x2;
       y1 = y2;
       repaint();
      public void mouseMoved(MouseEvent e)
      public void mouseClicked(MouseEvent e)
       repaint();
      public void mouseReleased(MouseEvent e)
      public void mouseEntered(MouseEvent e)
      public void mouseExited(MouseEvent e)
    }

  • Thought I knew Adobe...but can't figure out how to rotate an object in AdobeMUSE. Help?

    I can't figure out how to rotate an object in Adobe Muse. I want an object to be half a bubble off plumb.

    Hi ,
    You can rotate an object in Muse by using the Transform toolbar and selecting the rotation angle. Please refer to this screenshot :- http://prntscr.com/52vtux
    However, if you want to create a circular looking object , then all you need to do is, set the corners as Rounded, Make the Height and Width Equal and then increase the corner radius. This would give you the desired result.
    Please refer to this screenshot :- http://prntscr.com/52vu9n
    Hope this helps
    Regards,
    Rohit Nair 

  • CS6 - Is it possible to rotate multiple objects independent of one another?

    CS6 - Is it possible to rotate multiple objects independent of one another? In other words selecting say 9 object in a grid then rotating the all 30 degrees on their own axis.

    I forgot Transform > Again won't rotate each layer about its own centre.
    It can be done, though. Record an Action of a layer being rotated and followed by Opt+] or Alt+] to target next layer. It should look like the screenshot below. Use it by first running it on the lowest target layer in the stack then running however many more times is required.

  • Swinging/Rotating an object in AE 5.5

    Hi all,
    I have a question about something that I am trying to achieve in AE5,5.
    I have a clip that I would like to 'rotate' into the frame and was wondering how I could do this. If I might explain:
    If you can imagine the action of a clapperboard, you might have an idea of the effect I'm trying to attain.Essentially, I'd like the clip to start offscreen on the right hand side of the frame, At this point, the clip would be rotated 90 degree clockwise. Over the a next couple of seconds, I'd like it to 'crash' down into the frame, rotating around the lower, right corner so that it ends up filling the frame and the correct way up :-). I thought it would be fairly easy to do this with a few adjustments around the anchor points but I seem to be having no luck as whenever I move the anchor point, the entire clip seems to move rather than just adjusting the point at which I'd like it to rotate.
    What am I missing??
    Any help would be greatly appreciated.
    Many thanks,
    Sean

    :-) Ah, I've been rumbled!! To be honest, I come from a straight video editing background and am just starting to get to grips with AE. I have just cracked open the Classroom-In-A-Book this week and (naively) thought that it might be something I could achieve simply by changing the anchor point from which to rotate the object around.  Seems like I was slightly off track - maybe I should have perservered with the book before I tried!
    Many thanks for the replies - I will certainly have a look at the blog post you mentioned and will see how I get on. From what I've seen so far, AE looks like it's going to be keep me occupied for many, many months to come. I'm looking forward to it!
    thanks again,
    Sean

  • Click, animate rotation of Object by +90° via AS3?

    I have a button that will rotate an object in its parent by 90 degrees every time its clicked:
    b_rotate_CW.addEventListener(MouseEvent.CLICK, rotateCW);
    function rotateCW(event:MouseEvent):void
    Object(this).parent.module.rotation += 90;
    Which is fine, but I think it would be a nice touch if the object's rotation were animated.
    I tried this:
    import fl.transitions.Tween;
    import fl.transitions.easing.*;
    import fl.transitions.TweenEvent;
    b_rotate_CW.addEventListener(MouseEvent.CLICK, rotateCW);
    function rotateCW(event:MouseEvent):void
    var rCW:Tween = new Tween(Object(this).parent.module, "rotate", Strong.easeOut, 0, +90, .5, true);
    ... but it does nothing at all, I am guessing that "rotate" is a property option, I can find no documentation for that, only x, y, their scale and alpha.
    I'm sure this has been done by many, can anyone offer a helpful clue as to how this function would be properly coded?
    Thanks!

    Thats brilliant, I tweaked it a little; replaced the 0 with the current angle of the clip) and now it works perfectly:
    var rCW:Tween;
    b_rotate_CW.addEventListener(MouseEvent.CLICK, rotateCW);
    function rotateCW(event:MouseEvent):void
    rCW = new Tween(Object(this).parent.module, "rotation", Strong.easeOut, Object(this).parent.module.rotation, Object(this).parent.module.rotation+90, .5, true);
    Who would have known you could use a target path in place of a value?
    Where can everyone learn AS3 as you know it?
    Thank you again for your immense help!

  • Difficulty rotating ms3d object in java 3d

    I've created a few ms3d objects and have managed to successfully load them into my J3d program.
    I'm trying now to rotate this object through user interaction.
    I will start by just getting the object to rotate first and then add the keyboard interaction.
    Is it possible to rotate these objects, and does anybody have any link suggestions
    Thanks

    I've created a few ms3d objects and have managed to successfully load them into my J3d program.
    I'm trying now to rotate this object through user interaction.
    I will start by just getting the object to rotate first and then add the keyboard interaction.
    Is it possible to rotate these objects, and does anybody have any link suggestions
    Thanks

  • Javascript function to rotate an object around its axis

    Hello,
    I wonder if it is possible to rotate an object around its axis (eg 45 ° rotation)?
    I want to make this rotation with a button and a Javascript code!
    Is it possible? if so, have a track for me to start?
    thank you

    Possible, yes - but you will need some basic knowledge of how 3D matrix transformations work if you want to do anything complex.
    The code to rotate a node in a 3D scene by 45 degrees on the X axis is
    myNode.transform.rotateAboutXInPlace(Math.PI/4)

  • Rotation of objects

    I'm trying to move objects from A to B  (Round photos on a background of a map). During its way from A to B the object is shrinking. So far no problem. But my intention was to rotate the object on its "journey".
    But I didn't found a clue to work with anchor points, so the object is flying around an unknown anchor point (visible on the screenshot) instead of just turning in circles.
    I enclose two screenprints for your information.
    Am I asking too much?
    Not clear yet? I'll try to explain furher.
    Rob

    Rob,
    This is described in the help file and manual (page 258+). Select the clip in the timeline so it shows in the program monitor, select the motion effect in the effect controls panel and then adjust the anchor point by adjusting the figures in your screenshots by dragging left of right for both horizontal and vertical position. You can keyframe the anchor points so it flows nicely with the other keyframes you have set.

  • How do you rotate an object to any angle

    I have Adobe Acrobat 9 Pro. I am adding an object eg. square to the PDF file. I now want to rotate it to any angle, which I cannot do. I tried the help menu (TouchUp Object Tool) step by step and i am unsuccessfull. Please help.

    Thank you George for helping
    From Tools Menu. I selected customize toolbar, then selected rectangle tool from Comment and Markup Toolbar, then OK. Then from toolbar I selected the Rectangle and inserted it. I now need to rotate it.
    I have not tried the flattenning method, but after reading the notes by flattenning it becomes part of the page and can no longer be edited which is not what I require. Note I only need to rotate the little square on the page to any angle and not in 90 degree increments.
    The notes in the help topic (In Acrobat) on touchup object tool mentions it can be rotated incrementally, but when i follow the steps it does not work out. There is no handle to rotate the object.
    Regards
    Richard

  • Snap rotate an Object by 60 degrees around a selected point?

    Hello,
    I am looking for a simple and precise way to rotate and copy an object at precisely 60 degree increments around a preselected point that is NOT the middle of the object.
    To restate: I want to be able to have all my objects at precise angles and be rotating around a selected pre-chosen point.
    I have tried many different ways with no luck.
    Can anyone help a noob?
    Dave-o

    I just checked the Download-able Help PDF (the Illustrator CS4 Online manual) and it is indeed documented under "Rotate an object by a specific angle" Unfortunately, it does not jump out off the screen.
    I understand why they don't ship manuals to reduce cost and keep a greener footprint, but I really miss them especially when you pay $500+ for a software suite. Next time I will RTFOLM! :-)
    Thanks again Scott
    Dave-o

  • How do i partially rotate an object??

    hi people,
    i'm having trouble rotating an object - i can make it rotate
    fine but i can not make it rotate 90 degrees.
    i essentially want it to turn 90 degrees anti clockwise and
    then stay there - all i can manage to do is make it rotate 1 full
    rotation minimum.
    is there any way i can make it rotate a quater of a rotation.
    haven't been able to find any help on this so far.
    thanks

    This is an animated roatation right? Hard to tell if you want
    to rotate an object in the flash
    authoring environment.
    I assume it is animation so:
    1. Keyframe 1 symbol is in its original position
    2. insert keyframe 2 somewhere down the timeline
    3. rotate your symbol 90 degrees
    4. apply motion tween.
    Chris Georgenes
    Animator
    http://www.mudbubble.com
    http://www.keyframer.com
    Adobe Community Expert
    *\^^/*
    (OO)
    <---->
    quiffmonkey wrote:
    > hi people,
    >
    > i'm having trouble rotating an object - i can make it
    rotate fine but i can
    > not make it rotate 90 degrees.
    >
    > i essentially want it to turn 90 degrees anti clockwise
    and then stay there -
    > all i can manage to do is make it rotate 1 full rotation
    minimum.
    >
    > is there any way i can make it rotate a quater of a
    rotation.
    >
    > haven't been able to find any help on this so far.
    >
    > thanks
    >

  • Rotate an object

    Now there is a way to rotote an object....like clockwise..CW
    or CWW.....
    If I want to rotate an object but not just clockwise....I
    mean for example to move a ball that move around another ball ...
    like 3D not 2D...is it possible ? If not what do I need to do
    to do this ?

    Hi
    Int he first, you can create an animation for the ball while
    moves over the other ball in a layer above the standing ball. add
    the moving ball to a layer beneath the standing ball and created
    the animation part that goes behind the ball in it.
    This is in a brief, but you can search in google.com or
    www.flashkit.com about this rotation effect, I am sure you will
    find alot of its samples.

Maybe you are looking for

  • DBMS_JOB in 9i: Run job immediately

    Hello, ALL! RDBMS Version: 9.0.1.0.0 Operating System and Version: Linux RadHat 7.2 - 2.4.7-10 Before, in RDBMS Version 8.1.7 I set initial parameter job_queue_interval = 1 and run my job as: DBMS_JOB.SUBMIT(JOB_ID, PROC_NAME, SYSDATE, 'NULL'); job r

  • Refreshing parent window

    Hi My window is opening a pop up window which is itself a jsf, however when this pop up window get closed i need to refresh the parent window that loaded it (in example a compose mail window is loading a select contact window, the select contact wind

  • Stack overflow message on Verizon email home page

    On another computer with Windows XP, we just started getting a stack overflow at line __ message popup each time we go on the webpage. This only happens on the Verizon email homepage. It just started happening and doesn't happen on another Windows Vi

  • Javascript iWebmore RSS IDK

    I was wondering if anyone knew how to embed javascript into iWeb, I have tried iWebMore and it is not working for me. Thanks!

  • Account assignment u?

    hi can we use account assignment U in case of materail procurement.As far as i know it can be used in case of service.if we use it in case of material please explain me in detail with example.