Rotating a circle using mouse coords.

I'm trying to rotate a circle. I want the circle to rotate in
relation to the mouse movement across the y axis. Here is my code
so far:
onClipEvent (enterFrame) {
_root.xVal = Math.round(_root._xmouse-this._x);
_root.xMove = Math.round(_root.xVal/10);
this._x += _root.xMove;
_root.circle._rotation += _root.xMove*.4;
And here is the swf so far:
HERE
As you can see, this is the idea i am getting at. I would
like the globe to rotate CW when the mouse is moved to the right of
the globe and CCW when the mouse is moved to the left of the globe.
I would also like the globe to slow as it comes closer to the
mouse, but faster as the mouse is further away.. similar to the box
that moves above the globe.
When the mouse is put on the globe i woul like it to come to
a stop slowly so that the user can select something. If anyone has
any ideas please help.
Much appreciated,
Thanks.

hello,
i have seen your swf and i think you want the blocks on your
circle to be menubuttons if i'm right?
I would use back and next buttons to turn the button circle.
This because your mouse must be at your button.. and if you
move your mouse to the right or left to see the next button you can
never click the button thats on top at that time.
what you CAN do is make a rotationbar like your block.. and
if your mouse is on the rotationblock the circle rotates.(like you
did now)
if you get your mouse off the block the rotiation stops and
the button you want to see is on top.
so the only difference is that you need the mouse to be at a
predeclared area for rotation.
Greetz, jacob

Similar Messages

  • Can anyone help me to add method to rotate the image using mouse?

    Hi everyone, i am currently creating a game which require the user to be able to drag and rotate the image
    on the screen..but sadly...i'm only able to do the dragging part..
    Can anyone be able to help me add the method to rotate the image using the mouse?
    Thanks :-)
    the code
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.image.*;
    import java.awt.geom.*;
    class Game extends JFrame {
         DisplayCanvas canvas;
         public Game() {
              super("My Game");
              Container container = getContentPane();
              canvas = new DisplayCanvas();
              TitledBorder border = new TitledBorder("Game Window");
              border.setTitlePosition(TitledBorder.BOTTOM);
              canvas.setBorder(border);
              container.add(canvas);
              addWindowListener(new WindowEventHandler());
              setSize(450,400);
              show();
              class WindowEventHandler extends WindowAdapter {
                   public void windowClosing(WindowEvent e) {
                        System.exit(0);
              public static void main(String arg[]) {
                   new Example();
         class DisplayCanvas extends JPanel {
              int x, y;
              BufferedImage bi;
              DisplayCanvas() {
                   setBackground(Color.white);
                   setSize(450,400);
                   addMouseMotionListener(new MouseMotionHandler());
                   Image image = getToolkit().getImage("duke.gif");
                   MediaTracker mt = new MediaTracker(this);
                   mt.addImage(image, 1);
                   try {
                        mt.waitForAll();
                   catch (Exception e) {
                        System.out.println("Exception while loading image.");
                   if (image.getWidth(this) == -1) {
                        System.out.println("***Make sure you have the image "
                        + "(duke.gif) file in the same directory.*****");
                        System.exit(0);
                   bi = new BufferedImage(image.getWidth(this),
                   image.getHeight(this),
                   BufferedImage.TYPE_INT_ARGB);
                   Graphics2D big =bi.createGraphics();
                   big.drawImage(image, 0, 0, this);
              public void paintComponent(Graphics g) {
                   super.paintComponent(g);
                   Graphics2D g2D = (Graphics2D) g;
                   g2D.drawImage(bi, x, y, this);
              class MouseMotionHandler extends MouseMotionAdapter {
                   public void mouseDragged(MouseEvent e) {
                        x = e.getX(); y = e.getY();
                        repaint();

    research a bit on AffineTransforms. you can set the rotated instance of the Graphics2D class and it will do the rotations for you :-D

  • Rotating and dragging of image using mouse

    hi everyone,
    I've got problems with dragging and rotating of images using the mouse
    Can anyone show me how to that?
    Thanks a million

    Implement a MouseMotionListener on the Panel that you want to drag the image on.
    public void mouseDragged  (   MouseEvent e   )
           if ( e.getModifiers() == MouseEvent.BUTTON1_MASK )
              if ( dragged )
                  processMove( new Point2D.Double( e.getPoint().x, e.getPoint().y ) );
             else
               wasDragged = true;
                  dragged    = true;
                  dragPoint  = new Point2D.Double( e.getPoint().x, e.getPoint().y );
                  xDiff      = 0;
                  yDiff      = 0;
    private void processMove
         Point2D.Double    point
              Point2D.Double paintPoint = new Point2D.Double( point.x - dragPoint.x, point.y - dragPoint.y );
           BufferedImage  imageBak   = getCurrentBackgroundImage();
           BufferedImage  background = new BufferedImage( imageBak.getWidth(), imageBak.getHeight(), imageBak.getType() );
           Graphics2D     gr         = background.createGraphics();
           gr.setColor( adaptee.getUserProfile().getBackgroundColor() );
           gr.fillRect( 0, 0, imageBak.getWidth(), imageBak.getHeight() );
           gr.drawImage( imageBak, null, (int) paintPoint.x, (int) paintPoint.y );
              gr.finalize();
           xDiff += paintPoint.x;
           yDiff += paintPoint.y;
           dragPoint = point;
           getGraphicsForPanelToDrawOn()..drawImage( background, null, 0, 0 );       
           setCurrentBackgroundImage(  background );
              }

  • Rotate view tool over mouse center?

    Hello all!
    As the subject states - is there a way to use rotate view tool so that it's center of rotation is on the mouse / cursor location?
    I have tried different key command combinations and no go. If this is not possible at this point, then I would love to have that as a feature! It would be SO much more efficient and much less frustrating.
    I hate having the rotation center in the center of the window rather than where I am painting. Now, if there is an option to do this somewhere then please disregard my rant.
    Thanks
    Ray

    No, I don't mean that you wouldn't be using a mouse to do so- of course, you would be using the mouse. I am just simply saying that when you rotate the image using the rotate view tool, it doesn't spin the canvas around the point of the mouse, it spin's it as you said around the image window's center. That's all I'm saying.
    To me it would be much faster if it were to have an option to spin around the mouse's center because, as I mentioned before, try working on a zoomed in corner of your image and then when zoomed in and in that corner of the document, use the rotate view tool, because you want to get a better angle for painting in that corner area of the zoomed in image. Spin the image 45 deg and see what happens.
    The area you were just working on is now totally out of view and you either zoom out to find the area again and pan back to center that location and zoom back in to continue working on it or pan around to find and center it again. Either way, that stinks in comparison to just rotate the view based on either your last mouse click or where you mouse is at the moment.
    Do you understand?

  • How do I rotate a Circle in AS3?

    Hi,
    I want to rotate a circle so I can use it as a volume knob.  I can change the volume with a slider but not a knob.  Can anyone give me any suggestions?
    Thanks,
    Mikey

    Thanks, I've figured this out now.
    Mikey

  • Using mouse to draw cicrle

    hi,
    cuold you tell me how to draw the circle by mouse on xy graph, but in this case the equation to generate cricle is not required. that mean i will change the xy graph from indicator to control status and draw on it.
    sincerely,
    Tung

    tungu123 wrote:
    first of all, i change the xy graph from "indicator" to "control" condition. after that i will draw the circles or lines on this graph.  but i do not know how to draw because xy graph is not allow to draw when it is "changed to control" condition.
    I think you are not understading the basics of a graph. Changing a graph to a control does not magically turn it into a full featured drawing program.
    Have a look at the above quoted examples. Basically you need some code to read mouse-down and mouse-move coordinates, map them to the graph scale, then generate the graph data. You can (and should) leave the graph as an indicator.
    Open the example finder an look at example "draw graph with events". Let us know how far you get. Good luck!
    Instead of a graph, you could also use a picture indicator.
    If you have a newer LabVIEW version, you can use the "plot images" feature.
    Message Edited by altenbach on 02-22-2007 11:14 PM
    LabVIEW Champion . Do more with less code and in less time .

  • How to use Mouse Wheel Events

    Hello Everyone
    I am using Datagrid in my Canvas.
    I use mouse wheel to scroll the datagrid. But in one scroll
    through that wheel make the more than 4 rows to be scroll.
    So Now my requirement is to control the delta value of mouse
    wheel event and how to use that with my datagrid so that i will
    able to scroll one row through mouse wheel scroller.
    Thanks

    please give me some suggestion around it.
    I want to scroll one row of datagrid with per mousewheel
    scroll. I am not getting how to use the scrollMouseWheelMultiplier
    property of the IConfiguration class because i am not able to
    create the object of this class.
    I am using the Flex 3.0 and flash 9 version.
    please help me out around this.

  • How to measure the rotational speed by using rotary encoder and 1 counter?

    I want to measure the rotational speed of a shaft, and I have below hardware:
    1, a rotary encoder, with A,B,Z signals output;
    2, PCI-E6363 card.
    I do konw how to use such a  encoder to measure the rotational angle by using the function "DAQmxCreateCIAngEncoderChan", but this time I need to measure the speed(rpm), as well as the dirction of the speed, which means a negative speed represent a CCW rotate direction.
    More detail informations:
    for the encoder, the A,B signal is 600ppr, and Z signal is 1ppr
    the rotatinal speed is in range: -300 ~ 5000 rpm.
    some one suggested me that I can use the "DAQmxCreateCIAngEncoderChan" task to measure the angle firstly and then do the differential analysis with the angle. but I have to enable the Z index function, and it's hard to calculate when the shaft speed is fast then 2500rpm.
    Anyone can help me on this issue?
    Thanks in advance!

    RobertoBozzolo:
    Thansk for your reply. You are right that measure frequency to get the speed is the best way, but it's hard to get the dirction at the same time. You suggest me that "perform two angle measurements to get the sense of rotation", but I'm not sure I catched what you mean about this. I try to understand your opinion like this: distribute the signals to 2 counters, and start 2 tasks, one for frequency, the other for angle which used for deciding the dirction?
    And by the way, in my application, the counter is limited:
    I'm using PCI-E6363, which have 4 counters totally, and I have to measure 4 different speed sensors at the same time, so that means only 1 counter for me to measure the speed and the dirction.
    RobertoBozzolo 已写:
    To measure the speed from the encoder you can simply follow some of the frequency measurement examples that ship with DAQmx, considering that speed (rpm) is given by frequency (Hz) on one encoder output / 600 (ppr) * 60 (s->min)  = frequency / 10.
    Difficult is to add a sign to this measurement: frequency measurement gives you no information about sense of rotation, so I suppose you could perform two angle measurements to get the sense of rotation and then get the speed as above.

  • HI .. I have a new macmini 2.5 Ghz 10.7.3 Lion, had a problem today ,it froze so I could not shut down using mouse or tablet. used the power switch, when I tried to restart I got audible 'beeps' from it.

    HI ....I have a new macmini 2.5 Ghz 10.7.3 Lion, had a problem today ,it froze so I could not shut down using mouse or tablet pen. used the power switch, when I tried to restart I got audible 'beeps' from it. I managed to restart it but kept getting a message come up on one ot the dual screens ' restart using the power swich to turn it off , then press it again to restart.'
    This worked okay , but now it just keeps freezing whenever I start it up. I thought the issue could be my old Epson Expression 1680 scanner not being compatible , so I have unplugged it. I also had a look at the new memory I installed when I got it, but this seems not be the problem.
    It is connected up to an Eizo Flexscan S2231W using a cable straight into the HDMI input , the other monitor is a small Acer using the VGA into Thunderbolt port.
    When I turn the Eizo screen on first and then press the power button on the mac-mini, I hear the chime then the screen flahes the 'Digital no signal' message on and off for about 30 seconds , then the monitor comes on as normal. But it is still freezing up on me after using it for a while and I am having to use the power switch button to turn it off again.
    Can anyone help please.

    I really don't have an answer for that one. I guess that while trying to get things working correctly, I would use the most basic monitor I had which in your case would be the Eizon using the Thunderbolt port and adaptor.
    When you boot into Safe Mode the startup is quite slow, but you should get the Apple logo and then the spinning gear below it (release the SHIFT key when it appears.) Then after a little more time you should see a gray progress bar appear below the spinning gear. When that disappears the computer will startup to a login screen.

  • In firefox, the video from website "tv.vu.edu.pk" is not displaying even i have installed the latest version of JAVA. There rotates a circle around java monogram every time but video is not playing even it is working fine with internet explorer

    In firefox, the video from website "tv.vu.edu.pk" is not displaying even i have installed the latest version of JAVA. There rotates a circle around java monogram every time but video is not playing even it is working fine with internet explorer

    It's not working here as well with Java 6 U25 on Linux.

  • After las update some menus doesn't work properly. Ther is non possibility to use mouse. Why?

    After las update (9.2.1) some menus doesn't work properly. Ther is non possibility to use mouse. Why?

    Operating System?

  • [Fixed?] Cannot use mouse and touchpad at the same time after upgrade

    Dell Inspiron 6400 laptop, Synaptics touchpad, external wireless USB mouse (Logitech).
    Yesterday I did a full system upgrade which among other packages upgraded
    [2007-11-08 00:06] upgraded synaptics (0.14.6-2 -> 0.14.6.99-1)
    [2007-11-08 00:06] upgraded tzdata (2007h-1 -> 2007i-1)
    [2007-11-08 00:06] upgraded xf86-input-keyboard (1.1.1-1 -> 1.2.2-2)
    [2007-11-08 00:06] upgraded xf86-input-mouse (1.2.1-1 -> 1.2.3-1)
    [2007-11-08 00:06] upgraded xf86-video-i810 (1.7.4-2 -> 1.7.4-6)
    [2007-11-08 00:06] upgraded xf86-video-vesa (1.3.0-1 -> 1.3.0-5)
    [2007-11-08 00:06] upgraded xorg-server (1.2.0-5 -> 1.4-4)
    Before the upgrade, I was able to use both the touchpad and the mouse at the same time, using the following xorg.conf settings:
    Section "ServerLayout"
    InputDevice "Touchpad" "CorePointer"
    InputDevice "USB Mouse" "AlwaysCore"
    Section "InputDevice"
    Identifier "USB Mouse"
    Driver "mouse"
    Option "Device" "/dev/input/mice"
    Option "SendCoreEvents" "true"
    Option "Protocol" "IMPS/2"
    EndSection
    Section "InputDevice"
    Identifier "Touchpad"
    Driver "synaptics"
    Option "Device" "/dev/psaux"
    Option "Protocol" "auto-dev"
    EndSection
    After the upgrade, the touchpad was still working with these settings but the mouse wasn't.  I then changed the xorg.conf settings as follows:
    Section "ServerLayout"
    InputDevice "USB Mouse" "CorePointer"
    InputDevice "Touchpad" "AlwaysCore"
    with the InputDevice sections remaining the same for USB Mouse and Touchpad.  After this change the mouse was working but the touchpad wasn't.  Finally, I changed the xorg.conf settings as follows:
    Section "ServerLayout"
    InputDevice "Touchpad" "CorePointer"
    InputDevice "USBMouse" "SendCoreEvents"
    with the InputDevice sections remaining the same for USB Mouse and Touchpad.  This didn't change anything from the last setting: the mouse was working but the touchpad wasn't.
    How can I restore the ability to simultaneously use mouse and touchpad?
    Last edited by RobF (2007-11-09 20:20:54)

    Try this:
    Move "SendCoreEvents" to the Touchpad line (replacing the "AlwaysCore" bit) and then comment out the USB mouse.  So in the end, it'll look like this:
    Section "ServerLayout"
    InputDevice "Touchpad" "SendCoreEvents"
    # InputDevice "USBMouse"
    EndSection
    Restart X and see if everything is working right.
    PS: You may also want to consider changing the Touchpad device line to "/dev/input/mouse2" instead of "/dev/psaux" as I believe psaux has been deprecated in kernel 2.6.  I could be wrong, but I can tell you that /dev/input/mouse2 works great with the touchpad on my Dell e1505.

  • Is it possible to delete a plot with using mouse to select it on the graph control?

    For example, when I use PlotLine to plot thousands of lines on the graph control, I want to delete some of them, but there is thousands of plotHandle generated.
    How can I get the plotHandle of the specific line on the graph control with using mouse to select it?
    If I record information of the lines, ex. the plotHandle and the coordinates, on a table or list, etc. , I have to compare the information of lines to get the plotHandle of the specific line.
    Is there any user-friendly way to delete a plot by select it on the graph control?
    Solved!
    Go to Solution.

    Sure! Look at the example located in \samples\userint\graphcursors for an example of how to accomplish this task.
    Briefly:
    The cursor must be in "Snap to point" mode
    (To be confirmed) The graph must be in "Retain" data mode
    You must have a callback for the graph control
    You can use GetGraphCursorIndex to retrieve the plot handle
    GetGrpahCursor retrieves values of cursor position in engineering units
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Question #1plug in status "checking with mozilla on the status of your plug ins" blocked by continuously rotating grey circle Random "mozilla not responding

    Frequently get " mozilla firefox not responding" messages while already on yahoo page. When trying to trouble shoot on support page by going to "check with mozilla on the status of your plug ins" I am blocked by a rotating grey circle. Main problem is randomly appearing message "firefox not responding" which occasionally fixes itself but not always.

    hi jacinthe117, to address the issue that the plugincheck page is never finishing to load, please try to go to the firefox'' menu ≡ > addons > plugins'' & set the "java deployment toolkit" from ask to activate to '''never activate''' and then reload the plugin check page...
    [[Firefox hangs or is not responding - How to fix]]

  • Using mouse overs with pop-ups

    I'd like to create a pdf using mouse overs to display otherwise hidden text (in describing various portions of a photo in the doc).  Can anyone lead me in the right direction as specific guidance in 'Help' has so far been limited?

    You can use the "Tooltip" for an easy method. You can also use teh "On Focus" and "On Blur" action of a field to show or hide a hidden field by either the drop down actions or JavaScript.

Maybe you are looking for

  • SAP ECC 6.0 EHP5 with Opentext VIM 7.0 - Question on System Copy / Refresh

    Hi We are planning to perform a system refresh of our QA systems (platform: Windows / SQL 2005).  The ECC system has Opentext Vendor Invoice Management 7.0 on it. I was looking for some documentation explaining the Pre and / or Post system copy (refr

  • Dynamic VO error while testing without Application Module Pooling

    Hi, I am using ADF11g 11.1.1.4 I have a dynamic VO which is used to display data depending on user defined configuration . It works fine till I try to test the application for activation / passivation by disabling application Module The moment I do t

  • Stop a known compile error (Cannot resolve symbol)

    I get a known compile error is their some way to stop this. Basically I call a reader in a method in my main class to be used in a threaded search. I only reset the reader when I want to so I can search for further results without starting from the s

  • Why is script Chrome://global/content/bindings/browser.xml/244 and 245 not working?

    Accessing my bank, Firefox keeps giving the above error messages and not responding. Thunderbird is also afflicted with "not responding" I now use Opera which does not have any problems.

  • Building a Linux Box Part 2

    Originally I was thinking about building a shuttle box (shuttle barebones system).  After some research and some consideration to lifespan and futureproofness, here's plan B (for about the same price as the shuttle build, but with alot more potential