# Heres a good question, Hover Captions dynamically loaded

**URL:** <https://forum.kirupa.com/t/heres-a-good-question-hover-captions-dynamically-loaded/187667>\
**Category:** flash\
**Created:** [May 1, 2006, 1:19pm UTC](https://forum.kirupa.com/t/heres-a-good-question-hover-captions-dynamically-loaded/187667 "2006-05-01T13:19:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fattony](https://avatars.discourse-cdn.com/v4/letter/f/b5e925/32.png) [@fattony](https://forum.kirupa.com/u/fattony)\
**Post date:** [May 1, 2006, 1:19pm UTC](https://forum.kirupa.com/t/heres-a-good-question-hover-captions-dynamically-loaded/187667/1 "2006-05-01T13:19:24Z")

</div>

I want to load in text based in a text file on a site all by 1.txt, 2.txt … up to 20.txt. I had them load by rollover and put the text in a box but the client doesn’t want it that way they want the info to pop-up so I went with a hover caption trying to get the text to pop-up instead of filling the box. To my suprise the tut for the Hover captions is loaded -into- the captions in the actionscript I need to know the code to fill the caption with the text that gets loaded in each frame like so…

{AS}  
stop();  
loadText = new LoadVars();  
loadText.load(“1.txt”);  
//creating the loadVarsText function  
loadText.onLoad = function() {  
bone\_txt.text = this.bonetext;  
};{/AS}

And of course here is the caption code as far as I got it, not working btw… (cut off at button 5 for better readability)

[AS]  
b1.onRollOver = function() {  
captionFN(true, bone\_txt, this);  
this.onRollOut = function() {  
captionFN(false);  
};  
};  
b2.onRollOver = function() {  
captionFN(true, bone\_txt, this);  
this.onRollOut = function() {  
captionFN(false);  
};  
};  
b3.onRollOver = function() {  
captionFN(true, bone\_txt, this);  
this.onRollOut = function() {  
captionFN(false);  
};  
};  
b4.onRollOver = function() {  
captionFN(true, bone\_txt, this);  
this.onRollOut = function() {  
captionFN(false);  
};  
};  
b5.onRollOver = function() {  
captionFN(true, bone\_txt, this);  
this.onRollOut = function() {  
captionFN(false);  
};  
};

captionFN = function (showCaption, captionText, bName) {  
if (showCaption) {  
\_root.createEmptyMovieClip(“hoverCaption”, this.getNextHighestDepth());  
cap.desc.text = captionText;  
cap.\_width = 7\*cap.desc.text.length;  
cap.\_alpha = 75;  
//  
if ((bName.\_width+bName.\_x+cap.\_width)\>Stage.width) {  
xo = -2-cap.\_width;  
yo = -17;  
} else {  
xo = 2;  
yo = -17;  
}  
hoverCaption.onEnterFrame = function() {  
cap.\_x = \_root.\_xmouse+xo;  
cap.\_y = \_root.\_ymouse+yo;  
cap.\_visible = true;  
};  
} else {  
delete hoverCaption.onEnterFrame;  
cap.\_visible = false;  
}  
};  
[/AS]
