Pointing to the mouse using Atan2

When I try to use atan2 for the object with the mouse, you get still a little weird.

package

{

import flash.display.MovieClip

import flash.events.KeyboardEvent

import flash.events.MouseEvent

import flash.events.Event

import flash.ui.Keyboard

SerializableAttribute public class player extends MovieClip

{

var xdiff:Number; declares the variables

var ydiff:Number;

public void Player()

{

This.x = stage.stageWidth / 2; Put it in the Middle

This.y = stage.stageHeight / 2;

addEventListener (Event.ENTER_FRAME, EnterFrame);

}

function EnterFrame(event:Event):void

{

xdiff = mouseX - this.x; modifies the variables each enter_frame

ydiff = mouseY - this.y;

This.rotation = Math.atan2 (ydiff, xdiff) * (180 / Math.PI); the (180 / Math.PI) transforms the radians into degrees.

}

}

}

Here is the result - the faces of lighter arrow right in symbol, with the darkest arrow Editor to the left. If when facing to the right of the object = 0 degrees, probably the lightest arrow must always deal with the mouse?

Thanks in advance.

I use the x / y of the arrow_mc in my example and you are so when you use 'this.x"/"this.y ':

It's yours:

xdiff = mouseX - this.x; modifies the variables each enter_frame

ydiff = mouseY - this.y;

That's fine because you use this code "to the inside of your arrow", I'm not though. I get my parent mouseX/mouseY. I make it to the scene that is the parent of arrow_mc in my example. You get this from "mouseX', i.e. 'this.mouseX" or the location X of the mouse as opposed to the arrow, not the parent.

I don't know how your display hierarchy, but it could be as simple a fix as applicant mouseX of the parent.

for example:

xdiff = parent. mouseX - this.x;

ydiff = parent. mouseY - this.y;

Yet I know not your display hierarchy, but I think you understand that the code is not the same between the two.

Tags: Adobe Animate

Similar Questions

  • Satellite A660 - 07P problem with the pointer of the mouse using the touchpad

    I just bought my A660 07P last Thursday, September 15, 10 and I noticed that I had problems with the mouse pointer using the touchpad.

    From time to time, the cursor/pointer is locked and seems something like a button up and down.
    I assume it's because it's on a mode of waiting, but in this case as every 5 minutes.
    When it is locked, it will also change the zoom percentage when the touchpad is struck. It is very not when I'm in the middle of something and I can not move the pointer. In addition, the start is very slow.

    BTW, I have not installed any programs or applications. I'm still testing until Friday, otherwise I'll go back to where I bought it.

    Hi mate

    This isn't touchpad problem.
    I guess as support for computer laptop MULTI-TOUCH PAD
    There are a few additional features supported by touchpad, and I think that you have enabled this while using the touchpad

    The touchpad supports the features:
    _ChiralMotion_
    You can scroll vertically and horizontally

    _Pinch Zoom_
    This feature provides functionality like the scroll wheel zooming

    _Rotating (chiral spin) _
    This provides gestures to rotate the photos and other objects

    _Momentum_
    This feature provides a smooth, fast trackball as the movement of the mouse. A quick finger on the touchpad surface can move the sliders in the entire screen.

  • Start Windows vista, nothing on the screen, only the pointer of the mouse

    I have a gateway desktop vista, nothing on the screen, only the pointer of the mouse
    I used the recovery tools nothing fixs

    Hello

    "I used the recovery tools nothing fixs.

    It helps us if you tell us what they were.

    Here is the guide to repair Options using a Vista DVD from Microsoft.

    If a friend or a work acquantance of yours has one, you can borrow and use it for repairs.

    http://www.bleepingcomputer.com/tutorials/repair-Windows-with-Windows-Startup-Repair/

    Table of contents

    1. Overview of Windows Vista repair options
    2. How to perform an automatic repair of Windows Vista using Startup Repair
    3. Advanced Tools Overview
    4. Conclusion

    If you do not or can not borrow a Microsoft DVD there is a download of a file ISO of Vista Startup Repair available that you can put on a Bootable floppy to make the above startup repair and that the method is recommended by a large number of posters in these Forums.

    Unfortunately, you have to buy it.

    Here is a link to it:

    http://NeoSmart.net/blog/2011/Windows-Recovery-discs-updated-reinstated/

    @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    If necessary, here's how to reinstall back to new condition.

    "Gateway Recovery Center in Windows Vista® '

    http://support.gateway.com/s/software/MICROSOF/Vista/7515418/7515418asi.shtml

    Read these options to the gateway address:

    Gateway System Recovery from the hard - the following are methods to recover or repair the computer using the recovery of hard drive partition.

    See you soon.

  • How can I change the size of the pointer of the mouse for my product

    How can I change the size of the pointer of the mouse for my product

    If it can be changed, the controls will be in the start menu / Control Panel / mouse.  It is not possible with all brands of mice.  Perhaps a different drawing will be have more big pointers - see the different options.  If the option is not listed or those listed do not help, go to the website of manugacturer of the device and download the most recent driiver for your mouse and your version of Vista and install it (Start/Control / Panel / Device Manager) and see what provides all premanente options that weren't there before and can adjust the size.

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • I've upgraded to window 10, but not happy with windows 10 I returned to windows 7, but I'm unable to log on to the pc. the pointer of the mouse and keyboard are frozen device, even in safe mode.

    After the upgrade to windows 10, I loved not the style was thus to Windows 7, but I have not been able to log on the PC since. He's going through commissioning, but when on screen password box the pointer of the mouse and keyboard do not respond.

    This happens in safe mode for.

    The PC is a Sony Vaio laptop.

    Any suggestions,.

    John

    Hello Orwell,

    Thanks for posting your query in Microsoft Community.

    You have a Windows 7 installation disc?

    As you cannot start your computer at all, I suggest to run a Startup Repair to repair the damaged boot system files and try to boot into normal mode. See the section: How to use Startup Repair in the following link.

    Startup Repair: frequently asked questions

    If this does not help, try to boot from a disc to install Windows 7 on the Windows recovery environment mode and then try to run the Startup Repair tool and check if you are able to start normally with mouse and keyboard.

    Hope this information is useful. Let us know if you need more help, we will be happy to help you.

  • I lose the point of the mouse with a desktop in full screen with media center.

    I am running windows 7 64 bit. I have a graphics card 9800GT running a monitor and a LCD TV. I have the video installation of screens as extended desktop so that media center can run on the TV while I still have access to other functions of windows on the PC monitor. What happens is that when the library is running full screen on the TV I do not get a pointer on the other TV. When I close the Media Center or move it to full screen, the mouse pointer is still visible on both screens. It's really annoying. Does anyone know how to solve?

    I tried your suggestion and it did not work to retrieve the pointer of the mouse, BUT I don't have a partial solution. I bought a MCE remote and it allows me to control MCE well without the mouse. However, the downside is that I can't run other applications using the computer screen (the other view runs MCE) since I have no control of the mouse. Maybe you could help me out here. If I could remap a key on the remote control to switch in MCE mode while I run an app as I have everything that I need. Is there a key combination that will increase MCE from full screen to windowed mode?

    However, you must put in a bug report as I see quite a few others see mouse problems MCE running in mode full screen display.

  • I installed Windows 7 (64-bit) on my HP laptop. When I open a wizard, the point of the mouse frequently goes to the office.

    Hello

    I installed Windows 7 (64-bit) on my HP laptop. When I open a wizard, the point of the mouse frequently goes to the office.

    Example: If I type a URL in Internet Explorer the mouse point is for place in rear window (desktop) and I need to click on the URL bar to continue writing. It's frustrating to work.

    My first level of troubleshooting:

    Re-1 display drivers).

    (2) connected in safe mode and watched 5 minutes and has not seen the question. Seems the problem occurring in normal mode only.

    Thank you

    Vicky

    Hi Niranjan,

    Thanks for your reply. I tried some troubleshooting steps today morning and find the root cause of the problem.

    The problem with the driver for keyboard and mouse, so I uninsatlled form the machine. After the reboot, the problem disappeared, but my point of the mouse works slowly in any case I'm looking for the latest driver :)

    Thank you

    Vicky

  • Boring square around the pointer of the mouse in Windows 8

    Original title: boring square

    Our kitten sitting on the keyboard and now there is a square around the pointer of the mouse that I can not understand how to make it go away.  Windows 8.

    Hi Lesandru,

    What is the brand and model of the computer?

    It seems that the mouse settings should be changed, follow the steps below and check if this solves.

    (a) press the Windows key + X, select Control Panel.

    (b) Select mouse

    (c) in the Windows mouse properties, select the pointers tab.

    (d) select the Normal pointer.

    (e) click OK and apply.

    Let us know if you still face the question.

    See also section below.

    Mouse, touchpad and keyboard with Windows problems

    http://Windows.Microsoft.com/en-us/Windows/help/Mouse-touchpad-and-keyboard-problems-in-Windows

    Feel free to answer that if the problem persists, we're here to help.

  • Windows Media Center captures the pointer of the mouse on the 2nd monitor when WMC window is enlarged.

    My mouse pointer is captured on the 2nd monitor when the windows media center window is maximized on this screen. I can return the mouse to the main screen when the window of the wmc is reduced.

    Hi ijeff:

    One option is to move the Media Center window on the second monitor, and then expand the window to fill as much of the screen as possible by dragging an edge to the outside.  You can fill most of the screen that also and always use the mouse on each monitor.  The other option is to try pressing ALT + TAB to release the mouse in the Media Center window.  I think that worked in MCE2005, but currently I don't have a dual monitor set up to see if it still works.  Good luck!

  • Activate the pointer of the mouse on windows Tablet 8

    Hello

    I have a question on how to enable the mouse pointer on a touch screen of windows 8 tablets with no touch pad or are anchored.
    Is it possible to do this from the settings or control panel?
    I have here a way to install a virtual driver for a mouse to display the mouse pointer?
    Kind regards
    Mario

    No, the mouse pointer is not displayed, unless a pointing without touchscreen device is used.  If you use your finger, the mouse pointer is not drawn.

    Unlike the old operating systems (like Windows 7) who simply moved the slider and sent false "clicks" when you used the key, the touch system of Windows 8 is designed to work like that on the iPhone or Android: there is no cursor when you use the key (not even an invisible backstage).
  • Drawing a triangle shape through a script, reading a limits of the selection and the pointer of the mouse?

    Hello...

    It's a little more complicated, I guess...

    dialog sample.jpg

    I am looking for a way to automate the work I do for a manga magazine - cartoon or whatever they are called... I have a dialog box in an oval shape that is already formatted with a style of object to look like the oval in the left part of my image. I would like the script to read the position of the mouse pointer - I ran the script after selecting the oval and the place where the oval must point hover with the mouse... (In the picture so you can imagine my cursor somewhere in the lower left of the image, in the second part of the image corresponding to the angle of the triangle) I imagined this operation in at least two steps, the triangle (arrow) of the oval is a separate object (I would join the two forms later). The triangle can be with streight lines or maybe a little bent, for a most desirable look. I have no idea where to start, for now I create ovals and duplicate the triangle an old and position (+ turn) until I'm happy, after that I could join them. I hope the picture can better explain what I'm looking for.

    I know it is hard work - I think it may be useful for others, as it would be a good challenge for the very smart Scripting Guys of this forum...

    Thank you..

    Maybe you can use a single line to indicate the direction and the location where to that you must point.

    I did Speeech.js to illustrate this approach:

    http://www.Indiscripts.com/post/2012/01/speeech

    @+

    Marc

  • Can not see the mouse using projector

    When I use my macbook pro 2015, I don't see the cursor of the mouse (I see the effects of it, though) when connected to a projector using an HDMI cable.

    There are two ways of 'classics' to connect an external monitor. One is mirrored, the other is "Extended desktop", this picture of the Watch pane arranges extended desktop. Each blue rectangle is an icon for the location of the display on your bench. If you make them slide in the same order as they appear in fact, or remember that the area of the projector is "to the right/top/bottom/left" from the main screen, you can move the mouse across the border between views and drag items to follow correctly.

    .

  • Tecra M5: Moves the pointer of the mouse to the corners of the screen - cannot be moved

    Had this problem intermittently on my Tecra M5. The mouse pointer starts to crawl toward the edges/corners of the screen, then picks up speed quickly, he will bring back zipper in the corners and no amount of mouse movement. happens if I am rooted in a docking station or not. have tried on many mice with the same effect. Will and without explanation.

    Also tried various re-boots, changes to the pointer settings in Vista. Everyone knows this?

    One of my friends had a similar problem. Without a serious reason, the mouse pointer moved at the edge of the screen and it was not possible to control the mouse cursor.
    Finally, EPA has replaced the keyboard (possibly the touchpad too don t know exactly) and this fixed the strange cursor movements

    Then maybe you should contact the ASP in your country and ask for help.

    Best regards & good luck

  • Specify the end point for the digital using an output circular buffer

    When you use DAQmx and a NOR-DAQ for issuance of a digital signal using a circular buffer (buffer Renault). The program works and works, but when the 'DAQmx Stop Task.vi' function is called to end the task, he stops at the output buffering as soon as it is called and does not wait until the buffer pointer reaches the final value in the buffer. I would like that the program to wait until the buffer pointer is on the last value in the buffer, does anyone know how to specify this setting?

    If you need to stop on exactly the last sample output you will need a way to trigger the stop in the material.  The options available to you will depend on what hardware DAQ, you use, but here are some possibilities on the top of my head:

    1. set up a digital output redeclenchables task finished (not all hardware supports).  Set up a counter of output to issue a periodic trigger with the necessary synchronization signal such that the end result is a "continuous" digital output without interruption.  When you stop your loop, stop the task of counter - digital output ends his generation but the trigger signal will be removed and so it will not continue after that.

    2. If you have an unused extra digital output line, add it to your task.  This line should exit 0 all except the last sample.  Physically, this additional digital line in a wire line PFI and use it to trigger a meter output.  Have the output counter generate a single pulse of some long-term (long enough to ensure that the software can respond prematurely).  Use the output from the task of counter as a trigger of break for the task of digital output.  Do not start the task of the meter until you leave your loop.  Do not stop the task of digital output until you have detected in the software that the meter has been triggered.

    If you need to stop on approximately the last sample output, you could query the TotalSamplesPerChannelGenerated property after leaving your loop and only stop the task once it reaches a multiple of the size of your circular buffer.  This is no guarantee that it stops on the last sample (if you use a device on a bus with a latency higher as USB or Ethernet the non-determinisme would be worse).

    Best regards

  • OS boots to a white screen with the pointer of the mouse only

    doesn't show any desktop computer


    BONES appears at startup but without bars, icons or background when you are finished. Displays only the white screen with the mouse pointer. Even in safe mode unless there is safe mode in each of the 4 corners of the display discription and windows at top-center

    tablerock,
    Try the items listed on this thread.
    http://social.answers.Microsoft.com/forums/en-us/XPRepair/thread/901f9138-7a73-42f2-86ed-00c7fef3b77e

    Let us know the results. Mike - Engineer Support Microsoft Answers
    Visit our Microsoft answers feedback Forum and let us know what you think.

Maybe you are looking for

  • Can I use old AC adapter / CC with new X 1 carbon?

    I have a surplus of my first generation AC adapter X 1 carbon. It's 90W/20V. The adapter supplied with the new machine is quite a bit more small and only 65W/20V. Can I use the adapter 90 watts with the new model X 1, or it will damage somehow? Don't

  • ac149tx: cannot change the brightness

    I installed win 10 in my laptop free back ac149tx but f2 f3 brightness keys don't are not working.i tried to change the brightness of the windows Mobility Center, but his does not work as well.

  • Problems installing windows 7 32 or 64 XP 32

    Hello I decided it was time to upgrade to windows 7 xp 32. I'm on an IBM Thinkcentre. I did a lot of research but cannot circumvent this problem. When I insert the cd when the computer runs I get an error message saying that: "This installation disc

  • BlackBerry Smartphones can receive messages SMS /MMS SMS ICON and get error

    I have a blackberry bold 9000.  I downloaded an update this afternoon via Blackberry App World.  After the update and reboot, I get an eception exception Java lang null pointer exception error and my ICON of Message Tes\xt is missing and unable to re

  • image of Obiee 12 c road

    Hi experts,I migrated OBIEE 11 g to OBIEE12c with success, but I do not see the custom images. Some dashboard pages have an analysis of static text with HTML code like this< body >< a href = "saw.dll? Dashboard & PortalPath=/shared/Repo/_portal/00.Me