Easing a gotoAndStop(frame) given by the mouse position

Hi there.
I have an external swf loaded into the background and i want it to go to a frame according to the mouse vertical position.
Example: when the mouse is on the bottom part of the screen the movie is in the frame 0 and when it is on the top value goes to 800.
so far i did it like this:
_root.onEnterFrame = function ()
{
     var frame:Number = Stage.height-_ymouse;
     bgContainer.gotoAndStop(frame);
     
}
But somehow i need it to ease between the values given by the mouse position so that when there is a fast movement of the mouse, the swf only gradually goes to the frame equivalent to the last mouse position.
any sugestions??
Cheers!

actualFrame ist not a number NaN so i can't use it to define a frame to the clip to stop..
I just need a function that makes something like this:
_ymouse           ---->            clip.gotoAndStop()
     1                  ---->                     1
     800              ---->                     16
     800              ---->                     26
     800              ---->                     67
     800              ---->                     135
     800              ---->                     233
     800              ---->                     358
     800              ---->                     498
     800              ---->                     571
     800              ---->                     704
     800              ---->                     731
     800              ---->                     800

Similar Messages

  • Hwo to "track the mouse position"

    I m a java newbie, and need to write a small program to track the mouse position.
    basically, it opens a small window, and tell you the current mouse x, y coordinate. when mouse moves, hte x, y changes...
    by the way, how can i compile it to .exe file, after i finished coding.
    i try this way, but so many errors.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class mouseWin {
    public static void main(String[] args)
              protected int last_x=0, last_y=0;
              mouseMoved(MouseEvent e);
    JFrame frame = new JFrame("Mike's Mouse");
    JLabel X = new JLabel("x: " + last_x + "y: " + last_y);
    frame.getContentPane().add(X);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.pack();
    frame.setVisible(true);
         public mouseMoved(mouseEvent e)
              last_x = e.getx();
              last_y = e.gety();

    please help.
    i rewrite the code, but still cannot get it work
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.EventListener;
    public class mouseWin implements MouseMotionListener
    public static void main(String[] args)
                   int last_x;
                   int last_y;
                   last_x = 0;
                   last_y = 0;
                   JFrame frame = new JFrame("Mike's Mouse");
                   JLabel X = new JLabel("x: " + last_x + "y: " + last_y);
              frame.getContentPane().add(X);
                   frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                   frame.pack();
                   frame.setVisible(true);
         public void mouseMoved(MouseEvent e)
              last_x = e.getx();
              last_y = e.gety();
              JLabel X = new JLabel("x: " + last_x + "y: " + last_y);
    }

  • Moving the player to the mouse position.

    I have a question about moving and animated player symbol to the mouse location on a MouseDown event. Right now I have it set up to do an easing so that I can control how fast the player moves to the location. Problem is that it is done with easing. I don' t like the easing because the velocity of starts really fast and then slows down before it reaches the mouseX and mouseY location. I would like just a plain ol' stroll from the player location to the mouse location on the MouseDown event. Here is my code:
    package
    import flash.display.MovieClip;
    import flash.events.Event;
    import flash.events.MouseEvent;
    public class PlayerToMouse extends MovieClip
      //Declare constants
      private const EASING:Number = 0.1;
      //Declare variables
      private var _targetX:Number;
      private var _targetY:Number;
      private var _vx:Number;
      private var _vy:Number;
      public function PlayerToMouse()
       player.gotoAndStop(1);
       //Initialize variables
       _targetX = mouseX;
       _targetY = mouseY;
       _vx = 0;
       _vy = 0;
       //Add event listeners
       stage.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
      private function onEnterFrame(event:Event):void
       player.play();
       //Calculate the distance from the player to the mouse
       var dx:Number = _targetX - player.x;
       var dy:Number = _targetY - player.y;
       var distance = Math.sqrt(dx * dx + dy * dy);
       //Move the object if it is more than 1 pixel away from the mouse
       if (distance >= 1)
        //move the player
        _vx = (_targetX - player.x) * EASING;
        _vy = (_targetY - player.y) * EASING;
        //move the player
        player.x +=  _vx;
        player.y +=  _vy;
       else
        player.gotoAndStop(1);
        trace("Player reached target");
        removeEventListener(Event.ENTER_FRAME,onEnterFrame);
      private function onMouseDown(event:Event):void
       _targetX = mouseX;
       _targetY = mouseY;
       addEventListener(Event.ENTER_FRAME,onEnterFrame);
    Any input would be appretiated. I am a beginner and my mindset for the best coding procedure is not there yet.
    Shiim

    I didn't exactly figure in the constants of _vx and _vy, but I took a bit of your idea and created something that works to my liking. The downfall to my code is that the calculations in the onEnterFrame causes the player to not fully reach the destination, thus the animation never stops. I forced it to stop with an if statement that comes close enough to not be noticeable.
    Here is the edited code:
    if (distance >= 1)
        _vx = (dx /30);
        _vy = (dy /30);
        //move the player
        player.x +=  _vx;
        player.y +=  _vy;
        if (distance <= 15)
         _vx = 0;
         _vy = 0;
         player.gotoAndStop(4);
         removeEventListener(Event.ENTER_FRAME,onEnterFrame);
    Thanks for the input Ned.
    If anyone has any ideas to make this better, feel free to comment. I'm a beginner and can use all the advice I can get...
    Shiim

  • Get the mouse position

    If I have a frame and some panels on the frame, it seems I should not add the mouselisteners to the frame, but the panels. Now I can receive the mouse events. But when I try to get the mouse's position, they are the position's related to each panel. How can I get the positions associated with the frame?
    Thanks!

    public class MyFrame exyends JFrame implements MouseListener
    implement all the methods of Interface MouseListener
    e.g.
    public void mouseClicked (MouseEvent e)
    System.out.println("CLICKED AT " + e.getX() + "," + e,getY());

  • How to create an animation that rotates in response to the mouse position?

    Hey guys,
             I'm designing a home page that is centered around a logo. I need the logo to rotate around 360 degrees as the mouse explores the area around it. I'm attaching a quick sketch explaining the type of motion I need, a mockup of what the page might look like, and a .png file I'll be using for the logo. Please give detailed instructions, as I am somewhat new to Edge Animate. Thanks in advance, any help is MUCH appreciated!

    Thanks for the quick response! That is exactly the type of movement I need. I've placed the code into CompositionReady, replaced the var img reference, and changed the image url in the html portion. Unfortunately when I preview the animation nothing happens. The page opens with the logo and a white background, no response. Any ideas what I've done wrong? I'm assuming it's the placement of the code? I've attached a screenshot of where I placed it. Thanks in advance!

  • How to display the mouse position in a mouseBehavior?

    hi guys. how do i display the position of the mouse (x or y coordinate) every time i rotate a tansformgroup using a mouseRotate?..thanks

    Specify an AWT event as your behaviour's wakeupCriterion (MOUSE_DRAGGED or MOUSE_MOVED or something) and then do something like:
    x = event.getX();
    y = event.getY();

  • I would like to see the values from pointer mouse like cursor, i would like to put the mouse in point of graph and see the value of point!

    I want to use the mouse pointer like cursor, i want use in my graph xy, i dont like to move the cursor to see the point.
    is it possible?

    There are vi's available to read mouse position. Look for mouse in the example code section here. You can use the Position attribute of the property node of your graph to get the mouse position within the graph. You can get the range of the scales from the property node. Then it will be a bit of straightforward math to figure out the values.
    Beware that the size of the drawing area of the graph can change as the numbers in the scales get bigger or smaller! Good Luck
    Yours Sincerely
    John

  • How to change the mouse cursor icon type when mouse moves out of client area ( propertysheet) WTL?

    I got stuck with an issue in property sheet .I want to load different cursor when the mouse position is within the client area and load another when moves out of the client area.
    In the porpetysheet I added four page. In the first page when I click next I am loading cursor of IDC_WAIT type and loading IDC_ARROW when the mouse moves out of the client area.
    In the page class I triggered the event for WM_MOUSEMOVE as follow:
        MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
    LRESULT OnMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    if(TRUE == m_bIsNextBtnClicked)
    ::SetCursor(LoadCursor(NULL, IDC_WAIT));
    else
    ::SetCursor(LoadCursor(NULL, IDC_ARROW));
    return TRUE;
    This event is getting triggered and absolutely had no issue with this. Similarly I tried adding `MESSAGE_HANDLER(WM_MOUSELEAVE, OnMouseLeave)` this event making an assumption that this will get triggered if the mouse moves out of the client area,  but
    this event did not get triggered at all.If this is not the mouse event to be triggered for mouseleave which event should I trigger?
    LRESULT OnMouseLeave(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    ::SetCursor(LoadCursor(NULL, IDC_ARROW));
    return TRUE;
    Now when I click Next button , **I was actually calling a function which is taking sometime to return** . Before to this function I am loading IDC_WAIT cursor i.e., 
     `::SetCursor(LoadCursor(NULL, IDC_WAIT));` . 
    Now when move the mouse cursor on to the non-client area I want to load IDC_ARROW cursor i.e., 
        ::SetCursor(LoadCursor(NULL, IDC_ARROW)); 
    When the moves on to the non-client area I am handling the mouse event in sheet derived class as follows,
    MESSAGE_HANDLER(WM_NCMOUSEMOVE, OnNCMouseMove)
    LRESULT OnNCMouseMove(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
    ::SetCursor(LoadCursor(NULL, IDC_ARROW));
    return 0;
    This event is not getting triggered until unless the function in the Next button event is executed.
    I want both of them to be done in parallel i.e, click Next button now hover mouse on the client area, Busy icon should come and when mouse moves out of the client area then IDC_ARROW icon should come.
    LRESULT OnWizardNext()
    ::SetCursor(LoadCursor(NULL, IDC_WAIT));
    m_bIsNextBtnIsClicked = TRUE;
    BOOL bRet = MyFun();
    m_bIsNextBtnIsClicked = FALSE;
    //Until this function(MyFun()) is executed **WM_NCMOUSEMOVE**
    //event is not getting triggered.But this event should get triggered and I
    //should be able to see the change of cursor within and out of client area.
    Can anyone kindly help me to solve this issue.
    SivaV

    Hello
    sivavuyyuru,
    For this issue, I am trying to involve someone to help look into, it might take some time and as soon as we get any result, we will tell you.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Programming the mouse DIRECTLY

    Hi
    I need some help, I have written a Java program that interfaces to some hardware using the parallel port and a mouse encoder. I am reading the mouse position just using standard Java event handling, which I thought was going to be ok until I realised that the faster you move the mouse the greater the distance it moves! I need to talk to the mouse driver directly (win 32) but I havent got a clue how to go about doing this....any help would be much appreciated.
    Thanks

    the faster you move the mouse the greater the distance it movesThat's the way the mouse protocol works (at least for USB mice), so talking 'directly' to the hardware may not help.
    The windows API has a raw inpute API (e.g. GetRawInputDeviceInfo()),
    so you could call these functions via JNI.
    Good luck

  • How to get an Image to rotate according to the position of the mouse in Muse?

    Hey guys,
             I'm designing a home page that is centered around a logo. I need the logo to rotate around 360 degrees as the mouse explores the area around it. I'm attaching a quick sketch explaining the type of motion I need, a mockup of what the page might look like, and a .png file I'll be using for the logo. Please give detailed instructions, as I am somewhat new to Muse. Thanks in advance, any help is MUCH appreciated!

    UPDATE: The movement can be made very simply in Adobe Edge Animate through the following process:
    (and then published as an Animate Deployment Package and inserted into Muse as a .oam file.)
    "   Based on this stack exchange response Edit fiddle - JSFiddle
    Place the provided script in compositionReady and change the var img reference to the name of your element.
    example: var img = sym.$("WirelosLogoTight");     "
    - Heathrowe
      Hope this helps anyone else with the same question. Here is a link to that post: How to create an animation that rotates in response to the mouse position?

  • Return the position of the mouse

    I have an application in which i want to allow users to draw
    on a set area. The problem i am having is getting the draw function
    to loop and place a circle at the mouses position on the stage. I
    only want the drawing tool to work howver if it is over a set area.
    Would appreciate sample code that, while the mouse button is
    down a circle is created every 100 milliseconds within a rectangle
    at position (0, 0) with dimensions of 320 width by 240 height,
    thanks in advance!

    Will do! Ive got the entire source file if you like, its got
    some useful stuff in it :) P.S. its designed for an adobe air
    application

  • Mouse position capturing

    I was wondering if there is a way to capture the mouse position w/o the use of a frame or jframe? I already know how to use the MouseListener on the JFrame/Frame, but that is no help to me since I'm not using a frame at all. Any suggestions????

    What is your goal. This will work -- (the window is 1 pixel!) -- because the robot starts a "drag" and
    swing has mouse capture during drag, but as soon as the use clicks, it's over...
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class X {
        public static void main(String[] args) throws AWTException {
            JWindow w = new JWindow();
            Container cp = w.getContentPane();
            cp.addMouseMotionListener(new MouseMotionListener() {
                public void mouseDragged(MouseEvent e) {
                       System.out.println(e.getPoint());
                public void mouseMoved(MouseEvent e) {
            w.setBounds(new Rectangle(0,0,1,1));
            w.setVisible(true);
            Robot rob = new Robot();
            rob.mouseMove(0,0);
            rob.mousePress(InputEvent.BUTTON1_MASK);
            rob.mouseMove(100,100);
    [/code[

  • Convert mouse position to image position

    Using a zoomed IMAQ image in an image control, I want to recover the position of the mouse in the co-ords of the underlying image. LastMousePositionX (and Y) give the info I want but they are one click in the past and not the current position. Amazingly, there doesn't appear to be an equivalent CurrentMousePositionX. I can't seem to find the info I need to do the conversion manually. The mousedown event returns the current mouse position and I can get the position in the image container by subtracting off its left and top position. But to convert this to the image position I need to know both the zoom and where the images origin is relative to what is displayed. I can't seem to find that origin position in the list of property nodes. The only thing I can seem to come up with is to extract the info from teh image information string, but this seems like an incredibly poor way to extract such obvious information - espeically since the info must be calculated to put in the string anyway. Can anyone help with this?

    Hi,
    I am confused why you get the mouse position one click in the past because it seems to work ok for me. I've had to use four of the image properties to recreate the effect using the mousemove event, but this seems to give the same values as the Last Mouse Position property so I think it does what you want. I couldn't see an origin property so I did the conversion using the position given at the image center. I wanted to post a snippet here but I'm new to posting and couldn't seem to get it to work for the whole block diagram, so I'm using a screenshot instead. I hope this helps in some way.
    Will
    Attachments:
    mouse position test.vi ‏58 KB

  • System not sensing mouse position

    Starting today, my computer (iMac G5 PPC) no longer senses the position of my mouse pointer. For instance:
    - The dock doesn't magnify when the mouse is in it
    - None of the corners activate things like screensaver, expose, desktop
    - When I select a menu in the menu bar, moving the mouse over another menu item doesn't open that menu.
    In other words, OSX simply has no clue where my mouse pointer is located as I move it for all those neat automatic things. Yet, I can still use the mouse to click on items to make them work, then OSX knows where the mouse is.
    I've rebooted several times to no effect, but did notice something. As apps start up, the instant a window opens, OSX will sense the mouse position for that brief moment. For example, putting the mouse over the dock doesn't magnify, but when an app window appears, the dock will magnify that very instance. Moving the mouse out of the dock area doesn't unmagnify the dock, it's stuck in that state until either another window opens, causing OSX to sense the new position, or I click any mouse button which all gets OSX's attention and senses the mouse position.
    The pointer never changes when I'm over things like Links.
    Strange stuff. The mouse moves fine, it's just not being detected as it moves.
    Now, yesterday I installed a new ScanSnap scanner with the ScanSnap Manager software and Acrobat Standard ver. 7. But the mouse didn't have this behavior yesterday, or even this morning. This strange problem just appeared out of the blue mid-day today.
    I've since used Disk Utility and Onyx, and re-installed the 10.4.9 update. I switched to another user account, no difference, so it's definitely system wide.
    This doesn't stop me from using my iMac, but I just don't know how to fix this mouse issue besides a OSX re-install.

    Ok everybody, I finally got proper behavior, it's just too bad I'm not sure of the procedure.
    When I go to bed I usually run the mouse pointer to the upper left corner to activate the screensaver. Of course it didn't work. But I also knew that clicking a button causes the mouse to be sensed, so I was pushing some of the buttons while in the corner to see if I could get the screensaver going.
    Well, after doing this, everything is back to normal operation again. So, I fixed it totally by accident. Makes me wonder if there's some features that are turned on and off somehow by doing whatever it was I did up in that corner.
    Just so you know, I use a Logitech Cordless Optical Trackman. I swapped to the original Apple corded mouse but that made no difference.
    I never had a chance to try the suggestions since I just read them before posting this.
    Anyway, I hope I don't do again whatever it was that caused the behavior, but I am going to store this info in DEVONthink just in case something like this happens again.
    Anyway, it would still be interesting if someone could shed some light on this fix I accidently found. Perhaps some hidden capabilities/features? Or just dumb luck?

  • Mouse position on screen

    is there any way to get the mouses position on the screen (not a window)?
    Stephen

    Component c = (Component)e.getSource();
    Point p = e.getPoint();
    SwingUtilities.convertPointToScreen(p, c);
    System.out.println(p);

Maybe you are looking for

  • File to File transfer with a Mail Confirmation using BPM

    Hi everyone, I'm trying to configure a scenario where I will pick a file, send it to the appropriate receiver and send an acknowledgement mail to a mail account. I have created necessary business process, interfaces, mappings, data types in IR. Also,

  • Backup fails on vms 2.2 (idsmc/secmon 2.02)

    I’m using idsmc/secmon 2.02 and I have created a scheduled backup for the ids database however when ever it runs, it fails with the following error message. Common Java System Services Error SYSTEM Backup Operation failed, the database validation fai

  • Strange colour cast in LR3 with Canon G11 RAW

    Hi all, I recently bought Lightroom 3 to work with the RAW output from my Canon G11. The majority of the shots want to process are taken underwater around the UK coast. I'm having an issue with colour casts which I hope someone may be able to shed so

  • Bulk infoobject creation

    Hello guru's, Is any program or FM is avilable in sap BI/BW for bulk creation of infoobjects(Char/KF) in one go? Thanks, Rishi Nigam

  • Hittest with multiple objects...

    Ok I need some help! I'm trying to make a room with a little guy and he moves around the issue is that HE CAN WALK THE WALL it's like Spiderman... I want to only have to use one object with the same root name, but I want it to be a hittest so it's li