Mouse Coordinates and Timer Resolution

First - I am not a Flash or ActionScript programmer. I have
been asked by someone if I could port my ActiveX code (private) to
the Flash client. In researching all of the Flash, Flex and
ActionScript documentation, it appears that almost everything I
need is present... Almost....
A. My program relies on Mouse Coordinates being fed to it in
twips. The only possible references I get to this issue have come
from searching this forum.
- Is it true that the X and Y coordinates are returned to
ActionScript as floating point values that represent fractional
pixel values that I can translate to twips?
B. My program also relies on good timer resolution. The
Windows GetTicks() API is not sufficient, because it is returned
via the Windows message queue and can be off enormously at a
MouseMove event. Therefore, in my ActiveX code, I call the
QueryPerformanceCounter(), which gives me the resolution I need.
- Can anyone tell me what timer API the Flash client engine
is using for the values it returns?
Thank you,
Grant

I still don't understand your problem and apparently nobody else does either since there are no responses. Why don't you write a simple program (like I did for you on your last post) that demonstrates the problem.
"A picture is worth a thousand words".

Similar Messages

  • Mouse Coordinates and using the getPoint method

    Hello,
    I have a mouseClicked event that uses the getPoint method to get the coordinates of the mouse. Because the mouse is a shape (the cursor), it contains more than 1 pair of coordinates, so getPoint is supposed to return the coordinates of what is called the "hit point" of the mouse. Now because I use the standard mouse cursor (an arrow), the "hit point" is supposed to be its point edge, but I get the coordinates of the other edge!
    Now if I have a big JPanel in the window (without controls) that the user can press and the program needs to respond to the clicks, there are situations that the user presses somewhere and expects to get a specific response, but instead gets another one. That's because he/she is accustomed from other applications to use the point edge, but if the 2 edges of the cursor are in different regions in the panel (and thus generate different responses), they get the response of the other edge's region.
    Is there a way to solve this?
    Thanks.

    I still don't understand your problem and apparently nobody else does either since there are no responses. Why don't you write a simple program (like I did for you on your last post) that demonstrates the problem.
    "A picture is worth a thousand words".

  • Get mouse coordinates and fire bullet.

    So far here is my code in the fla:
    import flash.events.MouseEvent;
    Mouse.hide();
    main_crosshair.startDrag(true);
    main_crosshair.addEventListener(MouseEvent.MOUSE_DOWN, crosshairFX);
    function crosshairFX (e:MouseEvent):void{
              var projectile:bullet = new bullet();
              addChild(projectile);
              main_crosshair.gotoAndPlay(3);
              trace(crosshairX);
              trace(crosshairY);
    and this is my bullet.as :
    package {
              import flash.display.MovieClip;
              public class bullet extends MovieClip {
    Im trying to figure out how ot make it so that when I click my mouse it fires the bullet from the bottom right of the screen towards my cursor. That is the part I need help with now then I;m going to try and figure out myself how to test if an object is hit. Thanks in advance for any help.
    var PositionY:Number;
    var PositionX:Number;
    var crosshairX:* = Mouse.x;
    var crosshairY:* = Mouse.y;
    stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
    function onMouseMove(e:MouseEvent){
              var target:* = e.target;
              var location:Point = new Point(target.mouseX, target.mouseY);
              location = target.localToGlobal(location);
              PositionY = location.y;
              PositionX = location.x;

    Since you basically want to shoot something at an angle, the code should be pretty much the same.  You know where the origin of the bullet is (projectile.x/projectile.y) and you know where the destination points are (mouseX/mouseY).  That tutorial will help  show you how to use the Atan2 method to make an object travel from one place to another.

  • Mouse Coordinate issues caused by Scaling Components in a JScrollPane

    Hi All,
    I've been attempting to write a program that includes a simple modeler. However, I've been having some trouble with being able to select components when attempting to implement zoom functionality - when I "zoom" (which is done via scroll wheel) using the scale Graphics2D method, while it zooms correctly, the mouse location of components do not seem scale.
    I've tried one of the solutions found on the forums here (create a custom event queue that adjusts the mouse coordinates) and while it seemed to work initially, if I zoom in and adjust the current view position using the scrollbars, certain components contained in the JPane will become un-selectable and I haven't been able to work out why.
    I've attached a SSCCE that reproduces the problem below - it implements a JScrollPane with a JPane with a few selectable shapes set as the Viewport. The zoom is done using the mouse scroll wheel (with wheel up being zoom in and wheel down being zoom out)
    Any help in order to fix the selection/de-selection issues on zoom would be greatly appreciated! I've spent some time reading through the forums here but have unfortunately not been able to find a workable solution around it.
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.*;
    public class Tester extends JScrollPane
        public Tester() {
            this.setViewportView(new Model());
        public static void main (String[] args) {
            JFrame main = new JFrame();
            main.add(new Tester());
            main.setSize(500,300);
            main.setResizable(false);
            main.setVisible(true);
    class Model extends JPanel implements MouseListener, MouseWheelListener
        private GfxClass selection = null;
        private static double zoomLevel = 1;
        // zoom methods
        public void setZoom(double zoom) {
            if( zoom < 0 && zoomLevel > 1.0)
                zoomLevel += zoom;
            if( zoom > 0 && zoomLevel < 5.0)
                zoomLevel += zoom;
        public static double getZoom() { return zoomLevel; }
        public void resetZoom() { zoomLevel = 1; }
        public Model() {
            super(null);
            addMouseListener(this);
            addMouseWheelListener(this);
            MyEventQueue meq = new MyEventQueue();
            Toolkit.getDefaultToolkit().getSystemEventQueue().push(meq);
            for(int i = 0; i <7; i++) {
                double angle = Math.toRadians(i * 360 / 7);
                GfxClass oc_tmp = new GfxClass((int)(200 + 150 * Math.cos(angle)), (int)(125 + 100 * Math.sin(angle)), "Element"+i);
                add(oc_tmp);
            repaint();
        public void paint (Graphics g) {
            Graphics2D g2 = (Graphics2D) g.create();
            AffineTransform oldTr=g2.getTransform();
            g2.scale(getZoom(),getZoom());
            super.paint(g2);
            g2.setTransform(oldTr);
            setBackground (Color.white);
            super.paintBorder(g2);
        private static class MyEventQueue extends EventQueue  {
            protected void dispatchEvent(AWTEvent event) {
                AWTEvent event2=event;
                if ( !(event instanceof MouseWheelEvent) && (event instanceof MouseEvent) ) {
                    if ( event.getSource() instanceof Component && event instanceof MouseEvent) {
                        MouseEvent me=(MouseEvent)event2;
                        Component c=(Component)event.getSource();
                        Component cursorComponent=SwingUtilities.getDeepestComponentAt(c, me.getX(), me.getY());
                        JPanel zContainer= getZoomedPanel(cursorComponent);
                        if (zContainer!=null) {
                            int x=me.getX();
                            Point p=SwingUtilities.convertPoint(zContainer,0,0,(Component)event.getSource());
                            int cX=me.getX()-p.x;
                            x=x-cX+(int)(cX/getZoom());
                            int y=me.getY();
                            int cY=me.getY()-p.y;
                            y=y-cY+(int)(cY/getZoom());
                            MouseEvent ze = new MouseEvent(me.getComponent(), me.getID(), me.getWhen(), me.getModifiers(), x, y, me.getClickCount(), me.isPopupTrigger());
                            event2=ze;
                super.dispatchEvent(event2);
        public static JPanel getZoomedPanel(Component c) {
            if (c == null)
                return null;
            else if (c instanceof Model)
                return (Model)c;
            else
                return getZoomedPanel(c.getParent());
        private void deselectAll() {
            if(selection != null)
                selection.setSelected(false);
            selection = null;
        public void mouseClicked(MouseEvent arg0)  {    }
        public void mouseEntered(MouseEvent arg0)  {    }
        public void mouseExited(MouseEvent arg0)   {    }
        public void mouseReleased(MouseEvent arg0) {    }   
        public void mousePressed(MouseEvent me) {
            Component c1 = findComponentAt(me.getX(),me.getY());
            if(c1 instanceof GfxClass)
                if(selection != null)
                    selection.setSelected(false);
                selection = (GfxClass)c1;
                selection.setSelected(true);
            else
                deselectAll();
            repaint();
            return;
        public void mouseWheelMoved(MouseWheelEvent e) { // controls zoom
                int notches = e.getWheelRotation();
                if (notches < 0)
                    setZoom(0.1);
                else
                    setZoom(-0.1);
                this.setSize(new Dimension((int)(500*getZoom()),(int)(300*getZoom())));           
                this.setPreferredSize(new Dimension((int)(500*getZoom()),(int)(300*getZoom())));     
                repaint();
    class GfxClass extends Component { // simple graphical component
        private boolean isSelected = false;
        private String name;
        public GfxClass(int xPos, int yPos, String name) {
            this.name = name;
            this.setLocation(xPos,yPos);
            this.setSize(100,35);
        public void setSelected(boolean b) {
            if( b == isSelected )
                return;
            isSelected = b;
            repaint();
        public boolean isSelected() {
            return isSelected;
        public void paint(Graphics g2) {
            Graphics2D g = (Graphics2D)g2;
            if( isSelected )
                g.setColor(Color.RED);
            else
                g.setColor(Color.BLUE);
            g.fill(new Ellipse2D.Double(0,0,100,35));
            g.setColor(Color.BLACK);
            g.drawString(name, getSize().width/2 - 25, getSize().height/2);
    }Edited by: Kys99 on Feb 22, 2010 9:09 AM
    Edited by: Kys99 on Feb 22, 2010 9:10 AM

    Delete your EventQueue class. Change one line of code in your mouse pressed method.
    public void mousePressed(MouseEvent me) {
        Component c1 = findComponentAt((int) (me.getX()/getZoom()),
                                       (int) (me.getY()/getZoom()));
    }

  • Premiere Elements 13 issue with the mouse on When I select a clip of video and move to a different place in my time line, Premiere Elements 13, will not release the clip rom the mouse.    The clip follows my mouse movements and goes to other places in my

    Premiere Elements 13 issue with the mouse on MAC OSX Yosemite 10.10.1
    When I select a clip of video and move to a different place in my time line, Premiere Elements 13, will not release the clip from the mouse.
    The clip follows my mouse movements and goes to other places in my time line.
    I try to delete these extra insertions, but the mouse will not release the clip.
    Action I’ve taken: I’ve re-installed Premiere Elements 13. Problem remains.
    This issue has consumed too much of my time and does not go away.  It ruins my video.
    Help please.
    Thanks

    I tried using the Guest Account on my Mac. In the Guest Account, Illustrator works perfect!
    Then I started wondering what processes (tools/tweaks) I run by default on my account. Turned out the problem was called by a little background tool called RightZoom. RightZoom let's the green 'zoom' button always maximize your current window.
    So thanks! Problem solved!

  • CITADEL and RELATIONAL DATABASE Alarms & Events Logging Time Resolution

    Hello,
    I would like to know how I can setup Logging Time Resolution when Logging Alarms & Events to CITADEL or RELATIONAL DATABASE.
    I tried use Logging:Time Resolution Property of Class: Variable Properties without success.
    In my application I need that timestamp of SetTime, AckTime and ClearTime will be logged using Second Time Resolution, in other words, with fractional seconds part zero.
    I am using a Event Structure to get SetTime, AckTime and ClearTime events and I want to UPDATE Area and Ack Comment Fields thru Database Connectivity but when I use SetTime timestamp supplied by Event Structure in WHERE clause Its not possible get the right alarm record because there are a different time resolution between LV SetTime timestamp and timestamp value logged in database.
    Eduardo Condemarin
    Attachments:
    Logging Time Resolution.jpg ‏271 KB

    I'm configuring the variables to be logged in the same way that appears on the file you send, but it doesn't work... I don't know what else to do.
    I'm sending you the configuration image file, the error message image and a simple vi that creates the database; after, values are logged; I generate several values for the variable, values that are above the HI limit of the acceptance value (previously configured) so alarms are generated. When I push the button STOP, the system stops logging values to the database and performs a query to the alarms database, and the corresponding error is generated... (file attached)
    The result: With the aid of MAXThe data is logged correctly on the DATA database (I can view the trace), but the alarm generated is not logged on the alarms database created programatically...
    The same vi is used but creating another database manually with the aid of MAX and configuring the library to log the alarms to that database.... same result
    I try this sabe conditions on three different PCs with the same result, and I try to reinstall LabVIEW (development and DSC) completelly (uff!) and still doesn't work... ¿what else can I do?
    I'd appreciate very much your help.
    Ignacio
    Attachments:
    error.jpg ‏56 KB
    test_db.vi ‏38 KB
    config.jpg ‏150 KB

  • When I enter time machine (on Time Capsule) i see the stack of screen shots and the time line. However, when I roll over the mouse pointer, the time line does not activate. The cancel button does not get me out of the app: have to alt cmd esc. Ideas?

    When I enter time machine (on Time Capsule) i see the stack of screen shots and the time line. However, when I roll over the mouse pointer, the time line does not activate. The cancel button does not get me out of the app: have to alt+cmd+esc. Ideas?

    I have never seen it but then I run SL which is much more reliable than Lion..
    See
    http://pondini.org/TM/E4.html
    Check the master guru of all TM problems.

  • My computer will not let me type my password or move the mouse even though the date and time are changing and it's making a spinning noise what do I do??

    My computer will not let me type in my password or move the mouse but the date and time are changing and there is a spinning noise what do I do!!???

    Meredith199,
    does your MacBook Pro have an Eject key (⏏) in the top-right corner of the keyboard? If so, does pressing Control-⏏ show a restart/sleep/shutdown dialog box?
    If you press Shift-⌘Q, does your MacBook Pro recognize that as an attempt to log out?

  • Usb mouse auto disconnect time and time,Screen flash and flash when I use discrete graphic card

    as title
    My usb mouse auto disconnect and reconnect time and time,
    no one knows when the mouse will disconnect,but every time when that mouse disconnect ,it will be reconnected in 2-5sec.
    Screen flash and flash when I use discrete graphic card with the battery or use AC when connect the external display with VGA CABLE.
    Mouse: Logitec G400/G1
    Display:Lenovo D2081WIDE
    machine:T430 2349 CTO

    system info:
    machine TYPE: THINKPAD T430 /2349CTO
    operating system :Lenovo OEM ultimate X64 SP1
    mouse type:Logitech G400 and Logitech G1
    time:from 2012-10 to now
    threat NO.1
    USB mouse auto disconnect and reconnect time and time,no one knows when the mouse will disconnect,but every time when that mouse disconnect ,it will be reconnected in 2-5sec.
     every time when the mouse disconnect I heard the sound which like USB DEVICE unplug,and when it reconnected I heard the sound which like USB DEVICE plug in.
    threat NO.2
    Screen flash and flash when I use discrete graphic card with the battery or use AC when connect the external display with VGA CABLE.
    threat NO.3
    the battery auto losing capacity!!!!!!
    1% everyday about 0.2Wh
    since I bought to now,
    the Design capacity has losing from 57.XX Wh to 47.52Wh
    and full charge capacity is 48.68.
    the battery info:
    cycle count is 18
    Bar-Code number 1ZKFD27S1RF
    SerialNumber 1896
    First used date 2012-09
    FRU 45N1001
    Firmware 0003-0080-0100-0165

  • Mouse buttons and keyboard randomly stop responding on secondary display

    Hey,
    I'm facing this weird problem after a recent upgrade to Snow Leopard:
    In about half of the cases I'm switching to application windows on a secondary/external display the mouse buttons and Macbook keyboard are unresponsive. I have to keep clicking/pressing for some time or have to switch between applications to get them working, until they'll fail again after some time.
    I tested it with two different external displays with VGA and DVI adapter, different screen resolutions, I tested the mouse and mouse software, both keyboard and mouse work fine with the same applications moved to the primary laptop screen, trackpad works fine too.
    This occurred after the upgrade to Snow Leopard on a 2008 unibody Macbook. Updates to 10.6.2 didn't solve the problem.
    I'd be happy if anyone could help me with this issue.
    Thanks

    You do not provide the full model number but if it is an AMD processor you are seeing the start of video issues that plague that series. The freeze is caused by bad video memory which is a part of the video card in turn part of the motherboard. I have been getting a high percentage of people who do not respond back to posts so I am not going to write everything about your issue; it could be a book. I am happy to help further if you have any questions. There are some repair options but at the end of the day, you might want to consider a new laptop.

  • Plotting on xy graph based on mouse coordinates

    I am looking into plotting Mouse coordinates on XY Graph continuously based on where i move. My computer's resolution is 1200x800 and i would like it to plot based on where i move.,
    Attached is my progress so far.
    Attachments:
    progress.png ‏74 KB

    The XY Graph has a method which converts coordinates to XY values. You can call it by right clicking the graph and selecting Create>>Invoke Node>>Map Coordinates to XY.
    However, if you look at the help for it, you will see that the coordinates it expects are those of the pane the graph is in, and the coordinates you have are of the screen. You can convert your global coords to pane coords by getting the VI's Front Panel Window. Panel Bounds property, building two matching XY clusters from the data and subtracting them (assuming the VI only has one pane) or you can use another loop with an event structure and a Mouse Move event (which returns local data) on the graph and then transfer the position data to your loop (you could also use a single loop, but that might be more complicated because the event structure will process every move of the mouse as a new event).
    You will also need to keep the data to place in the graph somewhere. If you open the context help window and hover over the graph's BD terminal, you will see the data types it expects and you will need to build one of those yourself. A shift register is something you might want to look into. There are also some examples showing working with graphs in the example finder (Help>>Find Examples).
    Try to take over the world!

  • Mouse freeze and sound cutting out

    Since I've upgraded to OSX 10.9 (Mavericks), when I switch between open programs, my Logitech Performance MX mouse (uses USB receiver) stops responding for about 30 seconds.  When this happens,  the audio from my Bose speakers cuts out.  While the Logitech mouse is forzen, I can still use the Apple bluetooth trackpad.  To be clear, this mouse.audio chain reaciton issue doesn't happen every time I switch between open applications.  It doesn't seem to happen specifically when switching out of any particular application but it does seem to happen more frequently when switching out of Firefox.   But like i said, even with Firefox completely closed it still happens.
    Sometimes the audio will stutter a bit and then will kick back in, but sometimes even after hours the only way to get audio is to either switch to the iMac's internal speakers, or restart the computer.
    I opened the console to see what was happening when the mouse freezes and I get the following lines:
    11/3/13 1:43:49.000 PM kernel[0]: com_Logitech_HIPointing::terminate(kIOServiceSynchronous) timeout
    11/3/13 1:43:49.000 PM kernel[0]: USB Sound assertion in AppleUSBAudioStream at line 4767
    11/3/13 1:43:49.000 PM kernel[0]: IOAudioStream[0xffffff8039764000]::clipIfNecessary() - Error: attempting to clip to a position more than one buffer ahead of last clip position (478,209a)->(4a4,f26).
    11/3/13 1:43:49.000 PM kernel[0]: IOAudioStream[0xffffff8039764000]::clipIfNecessary() - adjusting clipped position to (4a3,209a)

    Alright, so I solved this myself by changing the resolution. Would've liked to resolve it a different way, but this works for now! So, anybody else who may see my issue.... go to system preferences>display and change the resoltuion.

  • New MBP and Time Machine won't let me search out my NAS to save too. Any ideas?

    When trying to set up time machine and using a NAS drive in my wireless network Time Machine won't let me search and select the storage device. I can access the storage and save/retrieve files so I can see and use it. Anyone got any ideas please?
    Brand New MBP running Mavericks.

    I'm having the same issue with Mavericks - and it appears to be Mavericks specific. I don't have this problem with Mountain Lion. Mountain Lion can see both of my NAS drives.
    Additionally, with Mavericks Time Machine won't see your backup properly. It may only see the most recent backup. Though in my case it wouldn't load either one (I had two on different drives). To recover some files I had to use a machine running Mountain Lion to mount a backup file then I was able to extract the files to a USB drive, which I then moved to the Mavericks machine.
    I've tried using terminal to run tmutil commands without luck. I have mounted the volume I want to use - it shows when I do "ls -l /Volumes". Then when I do sudo tmutil setdestination /Volumes/VOLUMENAME the system seems to go into an infinite loop. I have to ^c to get back to terminal.
    Clearly with Time Machine on Mavericke Apple has really screwed the pooch.
    MacBook Pro 2.3GHz i7 with DVD drive and standard resolution display.

  • How can I disable right/left mouse buttons and scroll wheel in PDF?

    Hi all,
    I want the user to have to click on "forward" and "back" buttons that I've created in the PDF, in order to move around in it. Is there any way to disable the mouse buttons and scroll wheel from allowing users to go back and forth?
    Also, a separate question: I want the user to click on embedded images and receive either a pop-up comment, or be re-directed to another page in the PDF. Is there any way to set this up?
    Thanks for your time!

    You can achieve what you want in Question 1, just not via scripting.  You would need to create a plug-in in C/C++ that would be installed on the client machine.  Other than that option, try67 is correct - there is no way to achieve this from the document-level.

  • Computer is balky random freezes across apps. Two hard drive cleans later (their scan reveals no hard drive problems) photo shop won't work at all, magic touch mouse inoperable and their diagnoses is corrupted data? Anybody heard of this?

    Computer is balky random freezes across apps. Two hard drive cleans later (their scan reveals no hard drive problems) photo shop won't work at all, magic touch mouse inoperable and their diagnoses is corrupted data? Anybody heard of this?

    Well, yes, data does get corrupted sometimes.
    The trick is finding what data.
    By 'cleaned' are you therefor meaning that the drive has been erased and the system re-installed?
    Because that's the quickest way to deal with such a situation.
    Back up the system first of course,
    Add back 3rd party apps one at a time in case one of them is causing the problem.

Maybe you are looking for

  • External Hard Drive won't shut down

    New MacBook Pro 15" and Tiger my Lacie external hard drive does not turn off when the computer is shut down. MacBook Pro 15"   Mac OS X (10.4.9)  

  • Unlocked Tour Internet Problems with ATT

    I purchased an Unlocked phone recently, and It makes, and receives text messages and calls perfectly, Im having trouble getting emails and/or browsing the web. The phones carrier is Verizon Wireless and I am using ATT. At the top right hand of the ph

  • Schema Names

    Dear OTN members, Is there a way to make the schema name appear on the GUI's connecting to that schema. I understand Oracle creates a schema by default for a user created in the Database. Is it possible to rename this schema for the GUI's look and fe

  • Cuando se solucionarán los problemas de compatibilidad de photoshop cc 2014 con la tableta Wacom pro.

    En Photoshop cc con windows 8.1 pro y tableta Wacom pro los márgenes de la pantalla no están ajustados el puntero se desplaza fuera de los márgenes y aparece en el lado opuesto. Pero que se ha solucionado en Photoshop cc 2014 pero que han surgido nue

  • Set ringtones

    set ringtones my iphone 4s