# \[Flash8\] invisible button rollover and \_xmouse/\_ymouse coordinates

**URL:** https://forum.kirupa.com/t/flash8-invisible-button-rollover-and--xmouse--ymouse-coordinates/262902
**Category:** flash
**Created:** [June 10, 2008, 10:33pm UTC](https://forum.kirupa.com/t/flash8-invisible-button-rollover-and--xmouse--ymouse-coordinates/262902 "2008-06-10T22:33:28Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![akkd](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@akkd](https://forum.kirupa.com/u/akkd)
#### Post date: [June 10, 2008, 10:33pm UTC](https://forum.kirupa.com/t/flash8-invisible-button-rollover-and--xmouse--ymouse-coordinates/262902/1 "2008-06-10T22:33:28Z")

</div>

I am an Actionscript beginner, though…

I created a map which can be moved up, down, left, and right. On the map are invisible buttons. When the mouse moves over an invisible button, a movie clip appears like a pop up info sign, doesn’t matter where I moved the map earlier. All this I accomplished by using this actionscript:

//-----ALL INVISIBLE BUTTONS LOCATED WITHIN MAPMIDSIZE\_MC-----//  
mgold\_mc.\_visible = false;  
mapmidsize\_mc.mgoldInv\_btn.onRollOver = function() {  
mgold\_mc.\_visible = true;  
mgold\_mc.\_x = \_xmouse-150;  
mgold\_mc.\_y = \_ymouse-50;  
};  
mapmidsize\_mc.mgoldInv\_btn.onRollOut = function() {  
mgold\_mc.\_visible = false;  
};  
//-----------------END--------------------//

So in general, it works, but…

The problem: the “pop-up sign” named mgold\_mc appears in slightly different spots, depending on where I “enter” [start to move my mouse over the “active/hot spot”] the invisible button mgoldInv\_btn.

Question: How can I make sure that mgold\_mc appears in the same, EXACT spot?

---

<div class="post-metadata">

### Author: ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)
#### Post date: [June 10, 2008, 10:56pm UTC](https://forum.kirupa.com/t/flash8-invisible-button-rollover-and--xmouse--ymouse-coordinates/262902/2 "2008-06-10T22:56:42Z")

</div>

Well the reason it is appearing in slightly different spots depending on where you rollOver it is right in your code

```auto

mapmidsize_mc.mgoldInv_btn.onRollOver = function() {
    mgold_mc._visible = true;
    mgold_mc._x = _xmouse-150;
    mgold_mc._y = _ymouse-50;
};

```

You have the X property set to show up wherever your mouse is minus 150px and the Y property set to wherever your mouse is minus 50 so of course it will change locations.

What you can do is something more or less what you have:

```auto

mapmidsize_mc.mgoldInv_btn.onRollOver = function() {
    var xPosition = 150;
    var yPosition = 50;
    mgold_mc._visible = true;
    mgold_mc._x = xPosition;
    mgold_mc._y = yPosition;
};

```

then just change those variables accordingly.

---

<div class="post-metadata">

### Author: ![akkd](https://avatars.discourse-cdn.com/v4/letter/a/46a35a/32.png) [@akkd](https://forum.kirupa.com/u/akkd)
#### Post date: [June 11, 2008, 6:02pm UTC](https://forum.kirupa.com/t/flash8-invisible-button-rollover-and--xmouse--ymouse-coordinates/262902/3 "2008-06-11T18:02:51Z")

</div>

Thank you! - I tried the suggested actionscript earlier. That certainly fixed the “jumping”, slightly different locations of the movieclip mgold\_mc when I rollover the invisble button mgoldInv\_btn… but keep in mind, the map mapmidsize\_mc on which this invisible button is located could be in a different position depending on what the webuser scrolled to! The code I posted with my question allows the mgold\_mc to appear where it should, except of course with the problem I described: slightly different spots. - It must have to do with the shape of the invisible button maybe? I used a square and also tried a circle (makes no difference). I also tried a making the invisble button as small as possible, which helps out with the “jumpyness” of the mgold\_mc, but makes it harder for the webuser to be able to “hit” the hot spot when rolling over it with his mouse. - Further suggestions that can help me out? I am stuck for three days now.
