Check if mouse in movie clip...?

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

  1. #1

    Default Check if mouse in movie clip...?

    Is there any easy way to check if the mouse is inside a movie clip...

    I'm wanting to check the mouse location, if it's not in my movie clip (drop menu) then remove the movie clip.

    Thanks
    MyFlashMXIN Guest

  2. Similar Questions and Discussions

    1. Movie clip mouse events
      Hi, Really enjoying learning Actionscript 2 but this one's stumped me... I have a movie clip called tabBar1_mc which contains tabs (eg tab0_mc)...
    2. need help positioning movie clip relative to a resizing clip...
      I am trying to attach a "caption" to the bottom right edge of a movie clip that resizes. I am using the resizing clip as a image holder for a...
    3. control main movie from inside a movie clip
      this has probably been discussed already but i couldn't find it, heck I may have already asked it. I have a movie clip with a button in it, when the...
    4. Duplicate Movie Clip in a Duplicated Movie Clip...
      I'm making a Flash Navigation Bar (menu) that could be freely customized by people just through a text file. The problem is that my submenus won't...
    5. Controlling main movie from within another movie clip..?
      Okay firstly heres the .swf of what im trying to do http://www.happylobster.co.uk/flash/flashtester.swf Basically I have 2 Scenes, each with a...
  3. #2

    Default Re: Check if mouse in movie clip...?

    //This is just a test script.
    //Move your mouse around the following coorinates (xMin,xMax,yMin,yMax)
    //You see your cursor will disappear.
    //You can simply replace theMouse.show() and Mouse.hide() with whatever you
    want
    //Of course, you can also change the coordinates.
    _root.onEnterFrame = function() {
    xMin = 0;
    xMax = 200;
    yMin = 0;
    yMax = 50;
    mX = _xmouse;
    mY = _ymouse;
    if (mX>xMin && mX<xMax && mY>yMin && mY<yMax) {
    Mouse.hide();
    //or do whatever you want
    } else {
    Mouse.show();
    //or do whatever you want
    }
    };


    jerreye04 Guest

  4. #3

    Default Re: Check if mouse in movie clip...?

    LMAO, that removed my mouse not my MC! :-)
    MyFlashMXIN Guest

  5. #4

    Default Re: Check if mouse in movie clip...?

    lol...Maybe I assumed too much. (I was trying to show you how to capture the
    location of your mouse)

    As you can see in my COMMENTS, you can replace the Mouse.hide() to whatever
    you want.

    If you want it to remove your MovieClip instead, then do that.

    I dont know exactly what you want to do, but you can work it out with this
    idea...

    _root.onEnterFrame = function() {
    xMin = 0;
    xMax = 200;
    yMin = 0;
    yMax = 50;
    mX = _xmouse;
    mY = _ymouse;
    if (mX>xMin && mX<xMax && mY>yMin && mY<yMax) {
    //myMC._visible = true;
    } else {
    //myMC._visible = false;
    //or you could do this as well (assuming you used either
    duplicateMovieClip(), MovieClip.duplicateMovieClip(), or
    MovieClip.attachMovie())...
    //myMC.removeMovieClip();
    }
    };


    jerreye04 Guest

  6. #5

    Default Re: Check if mouse in movie clip...?

    In case you havn't figured out your problem yet, here is my finished script:

    _root.onEnterFrame = function() {
    xMin = dropmenu._x;
    xMax = dropmenu._x+dropmenu._width;
    yMin = dropmenu._y;
    yMax = dropmenu._y+dropmenu._height;
    mX = _xmouse;
    mY = _ymouse;
    if (mX>xMin && mX<xMax && mY>yMin && mY<yMax) {
    dropmenu._visible = true;
    } else {
    dropmenu._visible = false;
    //or you could do this as well (assuming you used either
    duplicateMovieClip(), MovieClip.duplicateMovieClip(), or
    MovieClip.attachMovie() to load in "dropMenu")...
    //dropmenu.removeMovieClip();
    }
    };


    jerreye04 Guest

  7. #6

    Default Re: Check if mouse in movie clip...?

    Yep, figured it out from the last post, just ran out of time to reply... Thanks!
    MyFlashMXIN 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