rollOver if Mouse Coordinates?help me please!

Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default rollOver if Mouse Coordinates?help me please!

    i want to have a rollOver effect of gotoAndPlay if i rollOver x and y coordinates...

    how would i do this, i have the flash mx actionscript bible but i couldn't find what i was looking for, and i've searched for, so if anyone could help me it would be great?

    Thanx,
    Nick


    oxbownick Guest

  2. Similar Questions and Discussions

    1. Rollover - mouse over link
      I want to build a script that : if mouse over a link(total 4 links inside a big imge) a small image appears differ for each link at the place of the...
    2. Rollover state remains after mouse moves focus?
      I hope I am asking this question in the correct forum. I posted this same question yesterday, but havn't seem to have elisited a response. I have...
    3. Rollover effect on mouse
      H I am making a navigation bar and i want to know when ever someone click mouseover to one of the button I want a white fade going back and...
    4. Mouse Coordinates -- off .swf
      Hi - I'm trying to display mouse coordinates as a design element for my portfolio site. That part is easy enough, but I want to keep tracking the...
    5. mouse coordinates, help needed.
      Helllo to u all, Pronlem: I want to create a flashmovie with the following: Left side: An area (A) in which the mouse can move.... Right...
  3. #2

    Default Re: rollOver if Mouse Coordinates?help me please!

    use a continual loop to poll the mouse's position (and take appropriate action) or put an invisble button over those coordinates and define a rollover event for the button.


    kglad webforumsuser@macromedia.com Guest

  4. #3

    Default Re: rollOver if Mouse Coordinates?help me please!

    if (_root._xmouse>0 && _root._xmouse<50 && _root._ymouse>0 && _root._ymouse<50 &&) {
    *action here*

    -----------------------------------------------------------
    this will tell it to do what ever u want when the mouse points over an area between 0 to 50
    x & y u can change it to what ever you want! good luck


    z00male webforumsuser@macromedia.com Guest

  5. #4

    Default Re: rollOver if Mouse Coordinates?help me please!

    This is what i put pasted:

    ----------------------------------------------

    if (_root._xmouse>0 && _root._xmouse<50 && _root._ymouse>0 && _root._ymouse<50 &&) {
    sdapr3.gotoAndPlay (2);
    }

    -----------------------------------------------

    I'm getting these errors:


    Symbol=p4, Layer=actions, Frame=1: Line 1: Operator '&&' must be followed by an operand
    if (_root._xmouse>0 && _root._xmouse<50 && _root._ymouse>0 && _root._ymouse<50 &&) {

    Symbol=p4, Layer=actions, Frame=1: Line 2: ')' expected
    sdapr3.gotoAndPlay (2);

    Symbol=p4, Layer=actions, Frame=1: Line 3: Unexpected '}' encountered
    }



    oxbownick Guest

  6. #5

    Default Re: rollOver if Mouse Coordinates?help me please!

    hey, you may want to use the "movieClip.getBounds()" code for this one. use it together with the mouse.addListener to find out the coordinate. look up getBounds in the actionscript dictionary. it can be a bit tricky to work with though [well, my experience].

    i used it to make a status bar that hides when the mouse isn't near, but pops up when the mouse gets close [like Windows autohide feature =)].

    hope that helps.

    if you really think about it.... i wouldn't have to!

    -Marlon
    exorș webforumsuser@macromedia.com Guest

  7. #6

    Default Re: rollOver if Mouse Coordinates?help me please!

    i put this in a new layer named actions, is that right?


    oxbownick Guest

  8. #7

    Default Re: rollOver if Mouse Coordinates?help me please!

    I'll look into that, thanx for the help.

    Nick


    oxbownick Guest

  9. #8

    Default Re: rollOver if Mouse Coordinates?help me please!

    sorry this is the right code
    if (_root._xmouse>0 && _root._xmouse<50 && _root._ymouse>0 && _root._ymouse<50) {
    sdapr3.gotoAndPlay (2);
    }


    had an extra "&&"


    z00male webforumsuser@macromedia.com Guest

  10. #9

    Default Re: rollOver if Mouse Coordinates?help me please!

    I would go along with the original suggestion and create an invisible button or check for mouse coordinates, something like this might work

    checkcords = function (X, Y, amount) {
    if (Math.abs(X-_xmouse)<=amount && Math.abs(Y-_ymouse)<=amount) {
    trace("hello");
    // clearInterval(myInterval)
    }
    };
    myInterval = setInterval(checkcords, 50, 400, 500, 50);

    Certified but not by Macromedia!
    myurl
    stwingy webforumsuser@macromedia.com Guest

  11. #10

    Default Re: rollOver if Mouse Coordinates?help me please!

    does that AC go on the button or timeline...also if you would, could ya break that code down for me and explain what each one is and does...you don't have too, I understand a little of it but i am still new to some of this, but it would be greatly helpful if i understood it completely.

    thanx,
    Nick


    oxbownick Guest

  12. #11

    Default Re: rollOver if Mouse Coordinates?help me please!

    The code goes on the timeline, if you give the button an instance name of myButton, you can keep all code together
    checkcords = function (X, Y, amount) {
    if (Math.abs(X-_xmouse)<=amount && Math.abs(Y-_ymouse)<=amount) {
    trace("hello");
    // clearInterval(myInterval)
    }
    };
    myButton.onRollOver = function() {
    myInterval = setInterval(checkcords, 50, 200, 200, 10);
    };


    The function checks every 50/1000 secs if you rollOver Xcoord 200,Ycoord 200, +-10. Obviously you can change these values. You really need a way to clearInterval(myInterval) and you might do that in the other frame where you want it to go to.

    Certified but not by Macromedia!
    myurl
    stwingy webforumsuser@macromedia.com Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139