A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: how can i chack if the mouse goes up or down?

  1. #1
    Senior Member
    Join Date
    Apr 2000
    Posts
    136
    how can i chack if the mouse goes up or down?
    thank's

  2. #2
    Stick In The Mud
    Join Date
    Oct 2000
    Posts
    752
    do you mean on the screen or a mouse button being pressed...

    for the first bit, simply compare the position of the mouse to a point of origin, and the sign of this will tell you if it's up or down...eg.

    Code:
    yorigin=300;
    
    if (_root._ymouse>=yorigin){
    //mouse down
    }
    else{
    //mouse up
    }
    hope this is what you mean...

  3. #3
    Senior Member
    Join Date
    Apr 2000
    Posts
    136
    i think that in what you said it chack;s if the mouse is under or above 300, but i want it to know if i'm moving up or down allways.
    hope i made myself understandable.

  4. #4
    Senior Member
    Join Date
    Mar 2001
    Posts
    519
    You could put a control movieclip on the stage somewhere.

    just attach


    Code:
    onClipEvent (mousemove) {
       if (old > _root._ymouse) {
          _root.mouseDir = "Up"
          old = _root._ymouse
       } else {
          _root.mouseDir = "Down"
          old = _root._ymouse
       }
    }
    Not sure what you'd want it for but it works.

    A

  5. #5
    Senior Member
    Join Date
    Apr 2000
    Posts
    136
    well what i want to do is, to have a row of pictures that starts at the bottm left, and end at the top right. now evrytime the mouse will go up i want the row to move down, and oppsite.
    i'll try to play with you're code.
    thank's

  6. #6
    Senior Member
    Join Date
    Apr 2000
    Posts
    136
    could you help again? i didn't quit understand, you're code, where should i put it, and how do i tell it to do diffrent actions when it's "up" or "down".
    thank's again

  7. #7
    Senior Member
    Join Date
    Mar 2001
    Posts
    519
    Go to menu "Insert > New Symbol". Make the new movie a movie clip and give it a name. Drag it to the stage and it will appear as a tiny little object. Click on it, go to the object actions pane and add the code I gave you, when you debug the movie you will see it output "Up" and "Down" as your mouse moves.

    As to how you use it

    Where you see _root.mouseDir = "Up", you replace that line with the code (however much you like) for what you want to do when the mouse is going up.

    Where you see _root.mouseDir = "Down", you replace that line with the code (however much you like) for what you want to do when the mouse is going down.

    It's important, though, that you leave the line old = _root._ymouse in.

    OK

    A

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center