# Problem adapting Hover Captions tutorial

**URL:** <https://forum.kirupa.com/t/problem-adapting-hover-captions-tutorial/186582>\
**Category:** flash\
**Created:** [April 22, 2006, 3:59pm UTC](https://forum.kirupa.com/t/problem-adapting-hover-captions-tutorial/186582 "2006-04-22T15:59:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ggrrgh](https://avatars.discourse-cdn.com/v4/letter/g/77aa72/32.png) [@ggrrgh](https://forum.kirupa.com/u/ggrrgh)\
**Post date:** [April 22, 2006, 3:59pm UTC](https://forum.kirupa.com/t/problem-adapting-hover-captions-tutorial/186582/1 "2006-04-22T15:59:27Z")

</div>

Hi all,

Need some desperate help here. I’ve been figuring with the hover captions for hours and I just can’t seem to make it work.

I’ve added in another dynamic text field because I need my captions to have 2 lines, formatted differently. I’ve tried my changes using Kirupa’s source file, and it works perfectly fine.

But when I copy and paste the codes into my actual file containing all my buttons, something goes wrong. The caption appears, but it does not change when I rollover onto a different button. (I’m trying to input captions onto different adjacent regions in a map.)

Is there something wrong with the code?

```auto

b1.onRollOver = function() {
    captionFN(true, "B1", "hello", this);
    this.onRollOut = function() {
        captionFN(false);
    };
};
b2.onRollOver = function() {
    captionFN(true, "B2", "goodbye", this);
    this.onRollOut = function() {
        captionFN(false);
    };
};
captionFN = function (showCaption, captionText, captionDesc, bName) {
    if (showCaption) {
        _root.createEmptyMovieClip("hoverCaption", this.getNextHighestDepth());
        cap.name.text = captionText;
        cap.desc.text = captionDesc;
        cap._width = 7*cap.name.text.length;
        cap._alpha = 95;
        // 
        if ((bName._width+bName._x+cap._width)>Stage.width) {
            xo = -2-cap._width;
            yo = +4;
        } else {
            xo = 2;
            yo = +4;
        }
        hoverCaption.onEnterFrame = function() {
            cap._x = _root._xmouse+xo;
            cap._y = _root._ymouse+yo;
            cap._visible = true;
        };
    } else {
        delete hoverCaption.onEnterFrame;
        cap._visible = false;
    }
};

```

Thanks for any help!
