# Hover captions

**URL:** <https://forum.kirupa.com/t/hover-captions/186447>\
**Category:** Uncategorized\
**Created:** [April 21, 2006, 8:35am UTC](https://forum.kirupa.com/t/hover-captions/186447 "2006-04-21T08:35:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bulletz](https://avatars.discourse-cdn.com/v4/letter/b/f6c823/32.png) [@bulletz](https://forum.kirupa.com/u/bulletz)\
**Post date:** [April 21, 2006, 8:35am UTC](https://forum.kirupa.com/t/hover-captions/186447/1 "2006-04-21T08:35:32Z")

</div>

hello:  
i have 5 buttons created dynamically.  
code below;

```auto

for (var i;i<5;i++) {
var newname:String = "newnavboxmc"+i;
  _root.navboxmc.duplicateMovieClip(newname,i);    
  _root[newname]._y = 222.5 + (_root[newname]._height + 1) * i;
  _root[newname]._x = 5;
 
_root[newname].onRollOver = function() {
   captionMC.captionTxt.text = "my captions";    
   captionMC._visible = true;
   _root.hover = 1;    
  };
}

```

i also want to “captions” to show when the cursor is “rollOver” these buttons. In the \*\_root \*timeline, i have an instance named “captionMC”.  
code for this mc is:

```auto

captionMC.onEnterFrame = function() {
 if (_root.hover == 1) {
  this._x = _root._xmouse;
  this._y = _root._ymouse;
 } else {
  this._x = 0;
  this._y = 350;  
 }
};

```

problem is, when i “rollOver” my cursor onto the buttons…the caption is showing but under the button, i want it so the caption is somewhat “hovering”. i think the problem is with the depth, but i can’t figure out how to go around it. any help is appreciated.  
thanks in advance,

---

<div class="post-metadata">

**Author:** ![Mirandir](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Mirandir](https://forum.kirupa.com/u/Mirandir)\
**Post date:** [April 21, 2006, 12:10pm UTC](https://forum.kirupa.com/t/hover-captions/186447/2 "2006-04-21T12:10:43Z")

</div>

You can use the movieclip object’s swapDepths() method to put the captionMC movieclip on a higher depth.

e.g:

```auto

captionMC.swapDepths(100);

```

/Mirandir

---

<div class="post-metadata">

**Author:** ![ven](https://avatars.discourse-cdn.com/v4/letter/v/f9ae1b/32.png) [@ven](https://forum.kirupa.com/u/ven)\
**Post date:** [April 21, 2006, 12:20pm UTC](https://forum.kirupa.com/t/hover-captions/186447/3 "2006-04-21T12:20:25Z")

</div>

or

```auto
 captionMC.swapDepths(getNextHighestDepth());

```
